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 <jnoorman@igalia.com>
Fixes: 39088571f0 ("ir3: add support for predication")
(cherry picked from commit b2a44da9e9)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
Job Noorman 2026-03-24 15:25:14 +01:00 committed by Eric Engestrom
parent b640985aab
commit e2e2dc6bf7
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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];