Skip to content

Commit 1f8bead

Browse files
committed
[InstCombine] reduce code for swapped predicate; NFC
1 parent 1a1aed8 commit 1f8bead

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5908,13 +5908,12 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
59085908
if (Instruction *Res = foldICmpInstWithConstantNotInt(I))
59095909
return Res;
59105910

5911-
// If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now.
5912-
if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op0))
5911+
// Try to optimize 'icmp GEP, P' or 'icmp P, GEP'.
5912+
if (auto *GEP = dyn_cast<GEPOperator>(Op0))
59135913
if (Instruction *NI = foldGEPICmp(GEP, Op1, I.getPredicate(), I))
59145914
return NI;
5915-
if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op1))
5916-
if (Instruction *NI = foldGEPICmp(GEP, Op0,
5917-
ICmpInst::getSwappedPredicate(I.getPredicate()), I))
5915+
if (auto *GEP = dyn_cast<GEPOperator>(Op1))
5916+
if (Instruction *NI = foldGEPICmp(GEP, Op0, I.getSwappedPredicate(), I))
59185917
return NI;
59195918

59205919
// Try to optimize equality comparisons against alloca-based pointers.

0 commit comments

Comments
 (0)