diff options
author | Matt Turner <[email protected]> | 2015-12-01 16:13:11 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-12-08 15:41:08 -0800 |
commit | 3a7f95b3aa7397aa8a118d2634fdc5cf8f84f989 (patch) | |
tree | 0a8b97333d3d015c8a1baee932fcb244fcf3553f /src/glsl | |
parent | 9e9e6fc8f1458c311474becad8c52e986698d92d (diff) |
nir: Optimize useless comparisons against true/false.
Reviewed-by: Jason Ekstrand <[email protected]> [v1]
Reviewed-by: Eric Anholt <[email protected]> [v1]
v2: Move new rule to Boolean simplification section
Add a a@bool != true simplification
Suggested-by: Neil Roberts <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 6aa8b1f6cae..cb715c0b2c1 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -184,8 +184,10 @@ optimizations = [ (('fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'), (('frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'), # Boolean simplifications - (('ine', 'a@bool', 0), 'a'), - (('ieq', 'a@bool', 0), ('inot', 'a')), + (('ieq', 'a@bool', True), a), + (('ine', 'a@bool', True), ('inot', a)), + (('ine', 'a@bool', False), a), + (('ieq', 'a@bool', False), ('inot', 'a')), (('bcsel', a, True, False), ('ine', a, 0)), (('bcsel', a, False, True), ('ieq', a, 0)), (('bcsel', True, b, c), b), |