[Mesa-dev] [PATCH] nir: Optimize useless comparisons against true/false.

Matt Turner mattst88 at gmail.com
Tue Dec 8 15:44:41 PST 2015


On Fri, Dec 4, 2015 at 10:51 AM, Neil Roberts <neil at linux.intel.com> wrote:
> Matt Turner <mattst88 at gmail.com> writes:
>
>>  # Written in the form (<search>, <replace>) where <search> is an expression
>>  # and <replace> is either an expression or a value.  An expression is
>>  # defined as a tuple of the form (<op>, <src0>, <src1>, <src2>, <src3>)
>> @@ -94,6 +97,8 @@ optimizations = [
>>     (('inot', ('ige', a, b)), ('ilt', a, b)),
>>     (('inot', ('ieq', a, b)), ('ine', a, b)),
>>     (('inot', ('ine', a, b)), ('ieq', a, b)),
>> +   (('ieq', 'a at bool', true), a),
>> +   (('ine', 'a at bool', false), a),
>
> I think this second one is already in the file on line 187 here:
>
>    # Boolean simplifications
>    (('ine', 'a at bool', 0), 'a'),
>    (('ieq', 'a at bool', 0), ('inot', 'a')),
>
> Maybe you could add the first one near these two? It could be good to
> add a line like this as well to complete the set:
>
>    (('ine', 'a at bool', true), ('inot', a)),
>
> Regards,
> - Neil

Thanks. Both are good suggestions. I've squashed them into the patch.


More information about the mesa-dev mailing list