From: Matt Turner Date: Wed, 2 Dec 2015 00:13:11 +0000 (-0800) Subject: nir: Optimize useless comparisons against true/false. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3a7f95b3aa7397aa8a118d2634fdc5cf8f84f989;p=mesa.git nir: Optimize useless comparisons against true/false. Reviewed-by: Jason Ekstrand [v1] Reviewed-by: Eric Anholt [v1] v2: Move new rule to Boolean simplification section Add a a@bool != true simplification Suggested-by: Neil Roberts --- 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),