[match.pd] Fix for PR35691

Prathamesh Kulkarni prathamesh.kulkarni@linaro.org
Thu Nov 3 14:25:00 GMT 2016


On 3 November 2016 at 16:13, Richard Biener <rguenther@suse.de> wrote:
> On Thu, 3 Nov 2016, Prathamesh Kulkarni wrote:
>
>> Hi Richard,
>> The attached patch tries to fix PR35691, by adding the following two
>> transforms to match.pd:
>> (x == 0 && y == 0) -> (x | typeof(x)(y)) == 0.
>> (x != 0 || y != 0) -> (x | typeof(x)(y)) != 0.
>>
>> For GENERIC, the "and" operator is truth_andif_expr, and it seems for GIMPLE,
>> it gets transformed to bit_and_expr
>> so to match for both GENERIC and GIMPLE, I had to guard the for-stmt:
>>
>> #if GENERIC
>> (for op (truth_andif truth_orif)
>> #elif GIMPLE
>> (for op (bit_and bit_ior)
>> #endif
>>
>> Is that OK ?
>
> As you are not removing the fold-const.c variant I'd say you should
> simply not look for truth_* and only handle GIMPLE.  Note that we
> have tree-ssa-ifcombine.c which should handle the variant with
> control-flow (but I guess it does not and your patch wouldn't help
> it either).
>
> The transform would also work for vectors (element_precision for
> the test but also a value-matching zero which should ensure the
> same number of elements).
Um sorry, I didn't get how to check vectors to be of equal length by a
matching zero.
Could you please elaborate on that ?
Thanks!
>
> Richard.



More information about the Gcc-patches mailing list