Skip to content

Commit 150e1b6

Browse files
AZero13dtcxzyw
andauthored
Update llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Co-authored-by: Yingwei Zheng <[email protected]>
1 parent 4ee94da commit 150e1b6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,11 @@ static Value *canonicalizeSaturatedAddSigned(ICmpInst *Cmp, Value *TVal,
11591159
}
11601160

11611161
if ((Pred == ICmpInst::ICMP_SGE || Pred == ICmpInst::ICMP_SGT) &&
1162-
match(FVal, m_Add(m_Specific(Cmp0), m_APIntAllowPoison(C))) &&
1162+
match(FVal, m_Add(m_Specific(Cmp0), m_NonNegative(C))) &&
11631163
match(Cmp1, m_SpecificIntAllowPoison(
11641164
APInt::getSignedMaxValue(
11651165
Cmp1->getType()->getScalarSizeInBits()) -
1166-
*C)) &&
1167-
!C->isNegative()) {
1166+
*C))) {
11681167
// (X > INT_MAX - C) ? INT_MAX : (X + C) --> sadd.sat(X, C)
11691168
// (X >= INT_MAX - C) ? INT_MAX : (X + C) --> sadd.sat(X, C)
11701169
return Builder.CreateBinaryIntrinsic(Intrinsic::sadd_sat, Cmp0,

0 commit comments

Comments
 (0)