[PATCH] PR middle-end/21137: Folding if (((int)x >> 31) & 64) into if ((int)x < 0)

Jeff Law law@redhat.com
Mon Aug 8 17:05:00 GMT 2016


On 08/08/2016 05:58 AM, Marek Polacek wrote:
> On Mon, Aug 08, 2016 at 12:56:20PM +0100, Roger Sayle wrote:
>>
>> The following patch is an attempt to finally fully close PR middle-end/21137.
>> As explained in the PR, my original patch from 2006 didn't handle the case
>> where there's a sign preserving NOP in the tree.  Easily fixed by calling
>> tree_strip_nop_conversions at the appropriate point in fold-const.c.
>> Most of this patch is the resulting re-indentation.
>
> Shouldn't this be rather handled through the match.pd interface?
I don't see this transformation in match.pd.  So the whole 
transformation would need to be pulled out of fold-const.c and 
reimplemented in the match.pd framework.

Roger, are you up for that?  match.pd is certainly where we want much of 
this kind of stuff happening.

jeff



More information about the Gcc-patches mailing list