From cbbc24a4737f3768f423474f1a4740946b90e89c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 19 Jul 2025 18:39:03 -0400 Subject: [PATCH] agx: fix dead phis Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 2db7c4e6087..98dbeeeec85 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3256,7 +3256,16 @@ agx_optimize_nir(nir_shader *nir, bool soft_fault, uint16_t *preamble_size, NIR_PASS(_, nir, nir_opt_sink, move_all); NIR_PASS(_, nir, nir_opt_move, move_all); - NIR_PASS(_, nir, nir_lower_all_phis_to_scalar); + NIR_PASS(progress, nir, nir_lower_all_phis_to_scalar); + + /* After lowering phis to scalar, we must copy prop/DCE for correctness. RA + * can't deal with dead phis. + */ + do { + NIR_PASS(progress, nir, nir_copy_prop); + NIR_PASS(progress, nir, nir_opt_dce); + progress = false; + } while (progress); } /*