[PATCH] D23134: Make cltz and cttz zero undef when the operand cannot be zero in InstCombine
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 10:11:07 PDT 2016
spatel added a comment.
> I has no idea there was an assertion to make sure of this. I'd still go for the logic "if it is anything but true, make it true" rather than it "if it false, make it true".
I think that's fair - how about this:
if (KnownOne != 0 || isKnownNonZero(Op0, IC.getDataLayout()))
if (!match(II.getArgOperand(1), m_One()))
II.setArgOperand(1, ConstantInt::getTrue(II.getContext()));
But I think we need a comment to explain the transform and motivation. Something like
// If the input to cttz/ctlz is known to be non-zero,
// then change the 'ZeroIsUndef' parameter to 'true'
// because we know the zero behavior can't affect the result.
https://reviews.llvm.org/D23134
More information about the llvm-commits
mailing list