From 4071baf1b3c3c1640159672302d5aef5250719f3 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 31 Dec 2023 18:50:44 -0400 Subject: [PATCH] agx: const fold after discard lowering to avoid silly xor op with an unconditional discard. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index ab7fb8dc031..5c4598a7d80 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3112,14 +3112,13 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, if (nir->info.stage == MESA_SHADER_FRAGMENT && key->fs.nr_samples) { if (agx_nir_lower_sample_mask(nir, key->fs.nr_samples)) { /* Clean up ixor(bcsel) patterns created from sample mask lowering. - * If this succeeds, we'll have expressions to constant fold to get the - * benefit. We need to rescalarize after folding constants. + * Also constant fold to get the benefit. We need to rescalarize after + * folding constants. */ - if (agx_nir_opt_ixor_bcsel(nir)) { - NIR_PASS_V(nir, nir_opt_constant_folding); - NIR_PASS_V(nir, nir_lower_load_const_to_scalar); - NIR_PASS_V(nir, nir_opt_dce); - } + NIR_PASS_V(nir, agx_nir_opt_ixor_bcsel); + NIR_PASS_V(nir, nir_opt_constant_folding); + NIR_PASS_V(nir, nir_lower_load_const_to_scalar); + NIR_PASS_V(nir, nir_opt_dce); } }