From a071e917255fcf830427360ea3c5f7da8618825b Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Fri, 5 Dec 2025 17:01:21 +0100 Subject: [PATCH] ir3/legalize: run dbg nop/sync sched later Running nop sched before opt_jump runs into issues because at that point, we might have branches like this: getone x jump y which becomes this after nop sched: (rpt5)nop getone x (rpt5)nop jump y and then opt_jump may remove the jump leaving the block without a terminator. This in turn causes ir3_calc_reconvergence to calculate (jp) incorrectly. Sync sched is fine but let's keep the two together. Signed-off-by: Job Noorman Part-of: --- src/freedreno/ir3/ir3_legalize.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index c6cc5c1f847..58ed3e2602d 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -2254,14 +2254,6 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary) progress |= apply_fine_deriv_macro(ctx, block); } - if (ir3_shader_debug & IR3_DBG_FULLSYNC) { - dbg_sync_sched(ir, so); - } - - if (ir3_shader_debug & IR3_DBG_FULLNOP) { - dbg_nop_sched(ir, so); - } - bool cfg_changed = false; while (opt_jump(ir)) cfg_changed = true; @@ -2279,6 +2271,14 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary) so->compiler->gen >= 6) helper_sched(ctx, ir, so); + if (ir3_shader_debug & IR3_DBG_FULLSYNC) { + dbg_sync_sched(ir, so); + } + + if (ir3_shader_debug & IR3_DBG_FULLNOP) { + dbg_nop_sched(ir, so); + } + /* Note: insert (last) before alias.tex to have the sources that are actually * read by instructions (as opposed to alias registers) more easily * available.