[llvm] 1f8bead - [InstCombine] reduce code for swapped predicate; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 28 07:03:18 PDT 2021
Author: Sanjay Patel
Date: 2021-09-28T10:00:35-04:00
New Revision: 1f8bead67820ed3e1ad590ae4f49433c3771f86c
URL: https://github.com/llvm/llvm-project/commit/1f8bead67820ed3e1ad590ae4f49433c3771f86c
DIFF: https://github.com/llvm/llvm-project/commit/1f8bead67820ed3e1ad590ae4f49433c3771f86c.diff
LOG: [InstCombine] reduce code for swapped predicate; NFC
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 6ca3cb72d13c0..da41c39c10c30 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5908,13 +5908,12 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
if (Instruction *Res = foldICmpInstWithConstantNotInt(I))
return Res;
- // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now.
- if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op0))
+ // Try to optimize 'icmp GEP, P' or 'icmp P, GEP'.
+ if (auto *GEP = dyn_cast<GEPOperator>(Op0))
if (Instruction *NI = foldGEPICmp(GEP, Op1, I.getPredicate(), I))
return NI;
- if (GEPOperator *GEP = dyn_cast<GEPOperator>(Op1))
- if (Instruction *NI = foldGEPICmp(GEP, Op0,
- ICmpInst::getSwappedPredicate(I.getPredicate()), I))
+ if (auto *GEP = dyn_cast<GEPOperator>(Op1))
+ if (Instruction *NI = foldGEPICmp(GEP, Op0, I.getSwappedPredicate(), I))
return NI;
// Try to optimize equality comparisons against alloca-based pointers.
More information about the llvm-commits
mailing list