From daa3d5292fad6d10439cbc6a523a0c273d39d8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 2 Apr 2026 08:46:26 +0200 Subject: [PATCH] nir/opt_if: allow undef instructions on ELSE side for if-simplification Totals from 72 (0.04% of 202440) affected shaders: (Navi48) Instrs: 213900 -> 213873 (-0.01%); split: -0.03%, +0.02% CodeSize: 1215012 -> 1214924 (-0.01%); split: -0.01%, +0.01% Latency: 4458993 -> 4458679 (-0.01%) Copies: 18840 -> 18816 (-0.13%) Branches: 5044 -> 5043 (-0.02%) VALU: 116547 -> 116529 (-0.02%) SALU: 28686 -> 28669 (-0.06%) Part-of: --- src/compiler/nir/nir_opt_if.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c index d5a6fc12ac7..bab4fb9cfba 100644 --- a/src/compiler/nir/nir_opt_if.c +++ b/src/compiler/nir/nir_opt_if.c @@ -702,7 +702,8 @@ is_block_empty_or_constant(nir_block *block) return false; nir_foreach_instr(instr, block) { - if (instr->type != nir_instr_type_load_const) + if (instr->type != nir_instr_type_load_const && + instr->type != nir_instr_type_undef) return false; }