Skip to content

Commit db77078

Browse files
committed
Address review feedback
1 parent 689547b commit db77078

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,10 @@ Value *InstCombinerImpl::simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1,
698698
Value *Cmp1Op0 = Cmp1->getOperand(0);
699699
Value *Cmp1Op1 = Cmp1->getOperand(1);
700700
Value *RangeEnd;
701-
if (Cmp1Op0 == Input) {
702-
// For the upper range compare we have: icmp x, n
703-
RangeEnd = Cmp1Op1;
704-
} else if (isa<SExtInst>(Cmp1Op0) &&
705-
cast<SExtInst>(Cmp1Op0)->getOperand(0) == Input) {
706-
// For the upper range compare we have: icmp (sext x), n
701+
if (match(Cmp1Op0, m_SExtOrSelf(m_Specific(Input)))) {
707702
Input = Cmp1Op0;
708703
RangeEnd = Cmp1Op1;
709-
} else if (Cmp1Op1 == Input) {
710-
// For the upper range compare we have: icmp n, x
711-
Pred1 = ICmpInst::getSwappedPredicate(Pred1);
712-
RangeEnd = Cmp1Op0;
713-
} else if (isa<SExtInst>(Cmp1Op1) &&
714-
cast<SExtInst>(Cmp1Op1)->getOperand(0) == Input) {
704+
} else if (match(Cmp1Op1, m_SExtOrSelf(m_Specific(Input)))) {
715705
// For the upper range compare we have: icmp n, (sext x)
716706
Pred1 = ICmpInst::getSwappedPredicate(Pred1);
717707
Input = Cmp1Op1;

0 commit comments

Comments
 (0)