Skip to content

Commit ce13549

Browse files
committed
[InstCombine] foldOrOfICmps - use m_Specific instead of explicit comparisons. NFCI.
1 parent 7819411 commit ce13549

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,14 +2300,14 @@ Value *InstCombinerImpl::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
23002300
LHS->getType()->isIntOrIntVectorTy() && match(LHS1, m_APInt(LHSVal)) &&
23012301
match(RHS1, m_APInt(RHSVal)) && *LHSVal == *RHSVal && LHS->hasOneUse() &&
23022302
RHS->hasOneUse()) {
2303-
Value *LAddOpnd, *RAddOpnd;
2303+
Value *AddOpnd;
23042304
const APInt *LAddVal, *RAddVal;
2305-
if (match(LHS0, m_Add(m_Value(LAddOpnd), m_APInt(LAddVal))) &&
2306-
match(RHS0, m_Add(m_Value(RAddOpnd), m_APInt(RAddVal))) &&
2305+
if (match(LHS0, m_Add(m_Value(AddOpnd), m_APInt(LAddVal))) &&
2306+
match(RHS0, m_Add(m_Specific(AddOpnd), m_APInt(RAddVal))) &&
23072307
LAddVal->ugt(*LHSVal) && RAddVal->ugt(*LHSVal)) {
23082308

23092309
APInt DiffC = *LAddVal ^ *RAddVal;
2310-
if (LAddOpnd == RAddOpnd && DiffC.isPowerOf2()) {
2310+
if (DiffC.isPowerOf2()) {
23112311
const APInt *MaxAddC = nullptr;
23122312
if (LAddVal->ult(*RAddVal))
23132313
MaxAddC = RAddVal;
@@ -2326,7 +2326,7 @@ Value *InstCombinerImpl::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
23262326
if (LowRangeDiff.isPowerOf2() && LowRangeDiff == HighRangeDiff &&
23272327
RangeDiff.ugt(*LHSVal)) {
23282328
Value *NewAnd = Builder.CreateAnd(
2329-
LAddOpnd, ConstantInt::get(LHS0->getType(), ~DiffC));
2329+
AddOpnd, ConstantInt::get(LHS0->getType(), ~DiffC));
23302330
Value *NewAdd = Builder.CreateAdd(
23312331
NewAnd, ConstantInt::get(LHS0->getType(), *MaxAddC));
23322332
return Builder.CreateICmp(LHS->getPredicate(), NewAdd,

0 commit comments

Comments
 (0)