On Mon, May 9, 2016 at 3:36 PM, Marc Glisse <marc.gli...@inria.fr> wrote:
> On Mon, 9 May 2016, Dominik Vogt wrote:
>
>> This turns out to be quite difficult.  A small test function
>> effectively just returns the argument:
>>
>>  unsigned long bar (unsigned long in)
>>  {
>>    if ((in & 1) == 0)
>>      in = (in & ~(unsigned long)1);
>>
>>    return in;
>>  }
>>
>> However, Gcc does not notice that the AND is a no-op.  As far as I
>> understand, zero bit tracking is only done in "combine", so when
>> folding the assignment statement the information that the lowest
>> bit is zero is not available and therefore the no-op is not
>> detected?
>
>
> VRP is also supposed to track bits that may/must be non-zero. It may be
> possible to enhance it to handle this case.

Actually VRP only tracks value-ranges, CCP tracks may/must be non-zero bits
but does not have a conditional lattice.

Richard.

> --
> Marc Glisse

Reply via email to