We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b1a062 commit a5f6efbCopy full SHA for a5f6efb
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -994,8 +994,8 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
994
// trunc ( OP i8 C1, V1) to i1 -> icmp ugt V1, cttz(C1) - 1 iff (C1) is
995
// negative power of 2
996
if (DestWidth == 1 && match(Src, m_Shr(m_NegatedPower2(C1), m_Value(V1)))) {
997
- Value *Right = ConstantInt::get(V1->getType(), C1->countr_zero() - 1);
998
- Value *Icmp = Builder.CreateICmpUGT(V1, Right);
+ Value *Right = ConstantInt::get(V1->getType(), C1->countr_zero());
+ Value *Icmp = Builder.CreateICmpUGE(V1, Right);
999
return replaceInstUsesWith(Trunc, Icmp);
1000
}
1001
0 commit comments