[llvm] 2580745 - [ArgumentPromotion] Remove unnecessary getScalarType() before casting to PointerType. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 22:52:10 PDT 2020


Author: Craig Topper
Date: 2020-04-22T22:51:41-07:00
New Revision: 25807452ac1bca643bdc00f7555e9cad03097b0e

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

LOG: [ArgumentPromotion] Remove unnecessary getScalarType() before casting to PointerType. NFC

I don't believe this pass deals with vectors of pointers. I think
this getScalarType() was added during a mechanical opaque pointer
change of the interface to GetElementPtrInst::getIndexedType.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index e5b0125f8708..05aa497dc0e3 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -196,7 +196,7 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
       for (const auto &ArgIndex : ArgIndices) {
         // not allowed to dereference ->begin() if size() is 0
         Params.push_back(GetElementPtrInst::getIndexedType(
-            cast<PointerType>(I->getType()->getScalarType())->getElementType(),
+            cast<PointerType>(I->getType())->getElementType(),
             ArgIndex.second));
         ArgAttrVec.push_back(AttributeSet());
         assert(Params.back());


        


More information about the llvm-commits mailing list