Skip to content

Commit ed6227f

Browse files
committed
Fix use of variable in saturated add transformation
1 parent bd33b41 commit ed6227f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ static Value *canonicalizeSaturatedAddSigned(ICmpInst *Cmp, Value *TVal,
11351135
Value *Cmp0 = Cmp->getOperand(0);
11361136
Value *Cmp1 = Cmp->getOperand(1);
11371137
ICmpInst::Predicate Pred = Cmp->getPredicate();
1138-
Value *X, *Y;
1138+
Value *X;
11391139
const APInt *C;
11401140

11411141
// Canonicalize INT_MAX to true value of the select.
@@ -1209,7 +1209,7 @@ static Value *canonicalizeSaturatedAddSigned(ICmpInst *Cmp, Value *TVal,
12091209
match(FVal, m_c_Add(m_Specific(X), m_Specific(Cmp1)))) {
12101210
// (INT_MAX - X s< Y) ? INT_MAX : (X + Y) --> sadd.sat(X, Y)
12111211
// (INT_MAX - X s< Y) ? INT_MAX : (Y + X) --> sadd.sat(X, Y)
1212-
return Builder.CreateBinaryIntrinsic(Intrinsic::sadd_sat, X, Y);
1212+
return Builder.CreateBinaryIntrinsic(Intrinsic::sadd_sat, X, Cmp1);
12131213
}
12141214

12151215
return nullptr;

0 commit comments

Comments
 (0)