[llvm] c5b5b7f - [ConstantFolding] Remove ConstantFoldLoadThroughGEPIndices() API (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 23 07:59:39 PDT 2021


Author: Nikita Popov
Date: 2021-10-23T16:59:29+02:00
New Revision: c5b5b7f621ee5438c802d0b5a54c78af8a99dfa3

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

LOG: [ConstantFolding] Remove ConstantFoldLoadThroughGEPIndices() API (NFC)

The last user of this API went away in
4f5e9a2bb28e1cf4a12c9330f52e664542400ec7.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ConstantFolding.h
    llvm/lib/Analysis/ConstantFolding.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ConstantFolding.h b/llvm/include/llvm/Analysis/ConstantFolding.h
index a3e3f8f90afc..f4865f4e0883 100644
--- a/llvm/include/llvm/Analysis/ConstantFolding.h
+++ b/llvm/include/llvm/Analysis/ConstantFolding.h
@@ -150,13 +150,6 @@ Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE,
                                                  Type *Ty,
                                                  const DataLayout &DL);
 
-/// ConstantFoldLoadThroughGEPIndices - Given a constant and getelementptr
-/// indices (with an *implied* zero pointer index that is not in the list),
-/// return the constant value being addressed by a virtual load, or null if
-/// something is funny and we can't decide.
-Constant *ConstantFoldLoadThroughGEPIndices(Constant *C,
-                                            ArrayRef<Constant *> Indices);
-
 /// canConstantFoldCallTo - Return true if its even possible to fold a call to
 /// the specified function.
 bool canConstantFoldCallTo(const CallBase *Call, const Function *F);

diff  --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index c761fdeb09b0..8ec4ea109e2b 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1354,19 +1354,6 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
   return ConstantFoldLoadThroughBitcast(C, Ty, DL);
 }
 
-Constant *
-llvm::ConstantFoldLoadThroughGEPIndices(Constant *C,
-                                        ArrayRef<Constant *> Indices) {
-  // Loop over all of the operands, tracking down which value we are
-  // addressing.
-  for (Constant *Index : Indices) {
-    C = C->getAggregateElement(Index);
-    if (!C)
-      return nullptr;
-  }
-  return C;
-}
-
 //===----------------------------------------------------------------------===//
 //  Constant Folding for Calls
 //


        


More information about the llvm-commits mailing list