Skip to content

Commit a5f6efb

Browse files
committed
[InstCombine] Replaced comparison to uge
1 parent 8b1a062 commit a5f6efb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,8 +994,8 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
994994
// trunc ( OP i8 C1, V1) to i1 -> icmp ugt V1, cttz(C1) - 1 iff (C1) is
995995
// negative power of 2
996996
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);
997+
Value *Right = ConstantInt::get(V1->getType(), C1->countr_zero());
998+
Value *Icmp = Builder.CreateICmpUGE(V1, Right);
999999
return replaceInstUsesWith(Trunc, Icmp);
10001000
}
10011001

0 commit comments

Comments
 (0)