summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_constant_folding.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c
index 8f040619bfa..d6be807b3dc 100644
--- a/src/compiler/nir/nir_opt_constant_folding.c
+++ b/src/compiler/nir/nir_opt_constant_folding.c
@@ -155,6 +155,14 @@ constant_fold_intrinsic_instr(nir_intrinsic_instr *instr)
progress |= constant_fold_deref(&instr->instr, instr->variables[i]);
}
+ if (instr->intrinsic == nir_intrinsic_discard_if) {
+ nir_const_value *src_val = nir_src_as_const_value(instr->src[0]);
+ if (src_val && src_val->u32[0] == 0) {
+ nir_instr_remove(&instr->instr);
+ progress = true;
+ }
+ }
+
return progress;
}