[llvm] 5c8a71d - [InstCombine] Remove unnecessary icmp of all-zero gep folds (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 02:01:29 PDT 2023


Author: Nikita Popov
Date: 2023-10-30T10:01:21+01:00
New Revision: 5c8a71d82bcfd8f9d327c103aa036f1b003ca951

URL: https://github.com/llvm/llvm-project/commit/5c8a71d82bcfd8f9d327c103aa036f1b003ca951
DIFF: https://github.com/llvm/llvm-project/commit/5c8a71d82bcfd8f9d327c103aa036f1b003ca951.diff

LOG: [InstCombine] Remove unnecessary icmp of all-zero gep folds (NFC)

All-zero GEPs will be removed anyway, no need to special-case them
here.

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 1764917107f03f4..2ff27abc79318c4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -846,17 +846,6 @@ Instruction *InstCombinerImpl::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
       return transformToIndexedCompare(GEPLHS, RHS, Cond, DL, *this);
     }
 
-    // If one of the GEPs has all zero indices, recurse.
-    // FIXME: Handle vector of pointers.
-    if (!GEPLHS->getType()->isVectorTy() && GEPLHS->hasAllZeroIndices())
-      return foldGEPICmp(GEPRHS, GEPLHS->getOperand(0),
-                         ICmpInst::getSwappedPredicate(Cond), I);
-
-    // If the other GEP has all zero indices, recurse.
-    // FIXME: Handle vector of pointers.
-    if (!GEPRHS->getType()->isVectorTy() && GEPRHS->hasAllZeroIndices())
-      return foldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I);
-
     bool GEPsInBounds = GEPLHS->isInBounds() && GEPRHS->isInBounds();
     if (GEPLHS->getNumOperands() == GEPRHS->getNumOperands() &&
         GEPLHS->getSourceElementType() == GEPRHS->getSourceElementType()) {


        


More information about the llvm-commits mailing list