Skip to content

Commit 9f77eed

Browse files
AZero13dtcxzyw
andauthored
Apply suggestion from @dtcxzyw
Co-authored-by: Yingwei Zheng <[email protected]>
1 parent 150e1b6 commit 9f77eed

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
@@ -1171,12 +1171,11 @@ static Value *canonicalizeSaturatedAddSigned(ICmpInst *Cmp, Value *TVal,
11711171
}
11721172

11731173
if (Pred == ICmpInst::ICMP_SGT &&
1174-
match(FVal, m_Add(m_Specific(Cmp0), m_APIntAllowPoison(C))) &&
1174+
match(FVal, m_Add(m_Specific(Cmp0), m_NonNegative(C))) &&
11751175
match(Cmp1, m_SpecificIntAllowPoison(
11761176
APInt::getSignedMaxValue(
11771177
Cmp1->getType()->getScalarSizeInBits()) -
1178-
*C - 1)) &&
1179-
!C->isNegative()) {
1178+
*C - 1))) {
11801179
// (X > INT_MAX - C - 1) ? INT_MAX : (X + C) --> sadd.sat(X, C)
11811180
return Builder.CreateBinaryIntrinsic(Intrinsic::sadd_sat, Cmp0,
11821181
ConstantInt::get(Cmp0->getType(), *C));

0 commit comments

Comments
 (0)