[llvm] 9ca9c2c - [InstSimplify] Remove redundant gep zero fold (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 07:26:05 PST 2023


Author: Nikita Popov
Date: 2023-11-20T16:25:48+01:00
New Revision: 9ca9c2cf7e05a0fe44a8a688d0c322d5229511d9

URL: https://github.com/llvm/llvm-project/commit/9ca9c2cf7e05a0fe44a8a688d0c322d5229511d9
DIFF: https://github.com/llvm/llvm-project/commit/9ca9c2cf7e05a0fe44a8a688d0c322d5229511d9.diff

LOG: [InstSimplify] Remove redundant gep zero fold (NFC)

We already higher the all zero indices case above, no need to
also handle the special case of a single zero index.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 6323968b0d90bf8..7ef2ffd23b95e76 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4954,10 +4954,6 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
       });
 
   if (Indices.size() == 1) {
-    // getelementptr P, 0 -> P.
-    if (match(Indices[0], m_Zero()) && Ptr->getType() == GEPTy)
-      return Ptr;
-
     Type *Ty = SrcTy;
     if (!IsScalableVec && Ty->isSized()) {
       Value *P;


        


More information about the llvm-commits mailing list