From b730dff54ecead9d083eb5d37694da4807141bc9 Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Tue, 14 Apr 2026 17:28:49 +0200 Subject: [PATCH] ir3/postsched: update legalize state for terminators Terminators might need sync flags/delays and hence have an effect on scheduling decisions. Totals from 13218 (7.50% of 176258) affected shaders: Instrs: 12241764 -> 12237098 (-0.04%); split: -0.14%, +0.10% CodeSize: 23483966 -> 23479174 (-0.02%); split: -0.08%, +0.06% NOPs: 2594291 -> 2589625 (-0.18%); split: -0.67%, +0.49% (ss): 381711 -> 381252 (-0.12%); split: -0.41%, +0.29% (sy): 167625 -> 165596 (-1.21%); split: -1.21%, +0.00% (ss)-stall: 1645060 -> 1615134 (-1.82%); split: -2.11%, +0.29% (sy)-stall: 4920750 -> 4835994 (-1.72%); split: -1.89%, +0.17% Preamble Instrs: 2478730 -> 2478732 (+0.00%); split: -0.00%, +0.00% Cat0: 2881982 -> 2877316 (-0.16%); split: -0.60%, +0.44% Signed-off-by: Job Noorman Part-of: --- src/freedreno/ir3/ir3_postsched.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c index 72d39e315bc..a817deafc9a 100644 --- a/src/freedreno/ir3/ir3_postsched.c +++ b/src/freedreno/ir3/ir3_postsched.c @@ -763,8 +763,13 @@ sched_block(struct ir3_postsched_ctx *ctx, struct ir3_block *block) sched_dag_destroy(ctx); - if (terminator) + if (terminator) { + terminator->flags |= ir3_required_sync_flags( + &bd->legalize_state, ctx->v->compiler, terminator); + ir3_update_legalize_state(&bd->legalize_state, ctx->v->compiler, + terminator); list_addtail(&terminator->node, &block->instr_list); + } } static bool