From 2fd5b8a391a430d050d8525190d71c72e11ae0dd Mon Sep 17 00:00:00 2001 From: Christoph Pillmayer Date: Mon, 15 Dec 2025 15:55:37 +0100 Subject: [PATCH] pan/bi: Account for MEMMOV in bi_record_sizes Reviewed-by: Eric R. Smith Part-of: --- src/panfrost/compiler/bifrost/bi_spill_ssa.c | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/panfrost/compiler/bifrost/bi_spill_ssa.c b/src/panfrost/compiler/bifrost/bi_spill_ssa.c index cb6f7a44c4d..a1409fd4c98 100644 --- a/src/panfrost/compiler/bifrost/bi_spill_ssa.c +++ b/src/panfrost/compiler/bifrost/bi_spill_ssa.c @@ -1391,6 +1391,7 @@ bi_record_sizes(bi_context *ctx, uint32_t *sizes) assert(sizes[idx] == 0 && "SSA broken"); switch (I->op) { case BI_OPCODE_PHI: + case BI_OPCODE_MEMMOV: break; default: sizes[idx] = bi_count_write_registers(I, d); @@ -1411,6 +1412,28 @@ bi_record_sizes(bi_context *ctx, uint32_t *sizes) } } } + + /* After we know PHI sizes, determine MEMMOV sizes. */ + + bi_foreach_instr_global(ctx, I) { + if (I->op != BI_OPCODE_MEMMOV || I->dest[0].type != BI_INDEX_NORMAL) + continue; + + if (I->dest[0].memory) { + assert(!I->src[0].memory); + sizes[I->dest[0].value] = sizes[I->src[0].value]; + } + } + + bi_foreach_instr_global(ctx, I) { + if (I->op != BI_OPCODE_MEMMOV || I->dest[0].type != BI_INDEX_NORMAL) + continue; + + if (!I->dest[0].memory) { + assert(I->src[0].memory); + sizes[I->dest[0].value] = sizes[I->src[0].value]; + } + } } static void