[NVPTX] Pass explicit GEP type (NFC)
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 8 Jul 2021 18:59:56 +0000 (20:59 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 8 Jul 2021 19:21:43 +0000 (21:21 +0200)
Use source element type of original GEP, as we're just changing
the address space.

llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp

index 66cbd6e..ddb7f09 100644 (file)
@@ -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;