[llvm-commits] [llvm] r122330 - in /llvm/trunk: include/llvm/Analysis/InstructionSimplify.h lib/Analysis/InstructionSimplify.cpp lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
Frits van Bommel
fvbommel at gmail.com
Tue Dec 21 06:34:27 PST 2010
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.
This will also return null if the xor doesn't simplify even though
some later transformation might still work if it stays an 'add'.
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 '!')
Same goes for the 'i1 sub -> xor' and 'i1 mul -> and' transforms.
More information about the llvm-commits
mailing list