[llvm-commits] [llvm] r122330 - in /llvm/trunk: include/llvm/Analysis/InstructionSimplify.h lib/Analysis/InstructionSimplify.cpp lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

Duncan Sands baldrick at free.fr
Tue Dec 21 06:51:56 PST 2010


Hi Frits,

> On Tue, Dec 21, 2010 at 3:00 PM, Duncan Sands<baldrick at free.fr>  wrote:
>> +  /// i1 add ->  xor.
>> +  if (!MaxRecurse&&  Op0->getType()->isIntegerTy(1))
>> +    return SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1);
>> +
>
> Since !MaxRecurse is true, the MaxRecurse-1 argument will overflow to ~0U.

oops, fat fingers!  Now fixed - thanks.

> This will also return null if the xor doesn't simplify even though
> some later transformation might still work if it stays an 'add'.

I don't think that is possible.  I debated this with myself for some time -
skipping the extra tests should give a small speedup.  Maybe I will change
my mind again - I'm meditating on it :)

> So shouldn't this be something more like
>    /// i1 add ->  xor.
>    if (MaxRecurse&&  Op0->getType()->isIntegerTy(1))
>      if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1))
>        return V;
> ?
> (Note the missing '!')

Ciao, Duncan.



More information about the llvm-commits mailing list