summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py4
-rw-r--r--src/compiler/nir/nir_search_helpers.h6
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 1852a4d53f3..a557f7bf37d 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -267,9 +267,9 @@ optimizations = [
(('~frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),
# Boolean simplifications
(('ieq', 'a@bool', True), a),
- (('ine', 'a@bool', True), ('inot', a)),
+ (('ine(is_not_used_by_if)', 'a@bool', True), ('inot', a)),
(('ine', 'a@bool', False), a),
- (('ieq', 'a@bool', False), ('inot', 'a')),
+ (('ieq(is_not_used_by_if)', 'a@bool', False), ('inot', 'a')),
(('bcsel', a, True, False), a),
(('bcsel', a, False, True), ('inot', a)),
(('bcsel@32', a, 1.0, 0.0), ('b2f', a)),
diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h
index ebb77ae67aa..e925a2ba024 100644
--- a/src/compiler/nir/nir_search_helpers.h
+++ b/src/compiler/nir/nir_search_helpers.h
@@ -130,4 +130,10 @@ is_used_more_than_once(nir_alu_instr *instr)
return true;
}
+static inline bool
+is_not_used_by_if(nir_alu_instr *instr)
+{
+ return list_empty(&instr->dest.dest.ssa.if_uses);
+}
+
#endif /* _NIR_SEARCH_ */