[NVPTX] Pass explicit GEP type (NFC)

Use source element type of original GEP, as we're just changing
the address space.
This commit is contained in:
Nikita Popov 2021-07-08 20:59:56 +02:00
parent f57d396dca
commit b5a7da4391
1 changed files with 2 additions and 1 deletions

View 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;