[llvm] b5a7da4 - [NVPTX] Pass explicit GEP type (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 12:22:01 PDT 2021


Author: Nikita Popov
Date: 2021-07-08T21:21:43+02:00
New Revision: b5a7da43916ca61d7449892a2bb8ffa784953693

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

LOG: [NVPTX] Pass explicit GEP type (NFC)

Use source element type of original GEP, as we're just changing
the address space.

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp b/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp
index 66cbd6e19e287..ddb7f097fe685 100644
--- a/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp
@@ -177,7 +177,8 @@ static void convertToParamAS(Value *OldUser, Value *Param) {
     }
     if (auto *GEP = dyn_cast<GetElementPtrInst>(I.OldInstruction)) {
       SmallVector<Value *, 4> Indices(GEP->indices());
-      auto *NewGEP = GetElementPtrInst::Create(nullptr, I.NewParam, Indices,
+      auto *NewGEP = GetElementPtrInst::Create(GEP->getSourceElementType(),
+                                               I.NewParam, Indices,
                                                GEP->getName(), GEP);
       NewGEP->setIsInBounds(GEP->isInBounds());
       return NewGEP;


        


More information about the llvm-commits mailing list