From e2e2dc6bf72cdde86baed841a6911daf9e2f6b9e Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Tue, 24 Mar 2026 15:25:14 +0100 Subject: [PATCH] ir3/legalize: don't drop sync flags on removed predt/predf When a predt/predf branch can be removed, any sync flags set on the terminator were removed as well. Fix this by copying these flags to the prede that replaces the terminator. Fixes frame instability in "Devil May Cry 5" and "Resident Evil 3". Signed-off-by: Job Noorman Fixes: 39088571f08 ("ir3: add support for predication") (cherry picked from commit b2a44da9e940e81b18f5d14bca6c32924e3466de) Part-of: --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_legalize.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index edd075a2bfc..dcabebcd06d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2734,7 +2734,7 @@ "description": "ir3/legalize: don't drop sync flags on removed predt/predf", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "39088571f08ae0b8dee1cf51bf590df5c23962bf", "notes": null diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index 8e29697d478..cfb65615d46 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -1456,6 +1456,11 @@ prede_sched(struct ir3 *ir) list_delinit(&succ0_terminator->node); struct ir3_builder build = ir3_builder_at(ir3_before_terminator(succ0)); struct ir3_instruction *prede = ir3_PREDE(&build); + + /* legalize_block might have set sync flags on the terminator that we just + * removed; set them on prede instead. + */ + prede->flags |= succ0_terminator->flags; add_predication_workaround(ir->compiler, NULL, prede); remove_unused_block(succ1); block->successors[1] = succ0->successors[0];