From 45a5ccbf0720b59e05fde160576873c84244253a Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Fri, 14 Mar 2025 09:00:04 +0100 Subject: [PATCH] ir3/ra: create merge sets for splits/collects inserted for shared RA Since shared RA happens after creating merge sets, newly inserted splits/collects did not have merge sets created for them. Fix this by creating merge sets for new instructions after shared RA. Signed-off-by: Job Noorman Part-of: --- src/freedreno/ir3/ir3_shared_ra.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/freedreno/ir3/ir3_shared_ra.c b/src/freedreno/ir3/ir3_shared_ra.c index 70e4db5a2a6..3e797484b79 100644 --- a/src/freedreno/ir3/ir3_shared_ra.c +++ b/src/freedreno/ir3/ir3_shared_ra.c @@ -1464,6 +1464,9 @@ ir3_ra_shared(struct ir3_shader_variant *v, struct ir3_liveness **live_ptr) ctx.live = live; ctx.pcopy_src_map = _mesa_pointer_hash_table_create(NULL); + /* Used to detect instructions inserted by this pass. */ + unsigned last_old_serialno = v->ir->instr_count; + foreach_block (block, &v->ir->block_list) { handle_block(&ctx, block); } @@ -1494,6 +1497,16 @@ ir3_ra_shared(struct ir3_shader_variant *v, struct ir3_liveness **live_ptr) *live_ptr = ir3_calc_liveness(live_mem_ctx, v->ir); (*live_ptr)->interval_offset = interval_offset; + /* Create merge sets for the splits/collects created by this pass. */ + foreach_block (block, &v->ir->block_list) { + foreach_instr (instr, &block->instr_list) { + if (instr->serialno > last_old_serialno && + (instr->opc == OPC_META_SPLIT || instr->opc == OPC_META_COLLECT)) { + ir3_aggressive_coalesce(*live_ptr, instr); + } + } + } + /* We've created instructions that will be handled by regular RA (e.g., * shared spills) so make sure they have their interval offsets assigned. */