Skip to content

Commit c8aaa5f

Browse files
committed
Update for LLVM GEP API change
Update for LLVM commit b00cff56cfb1 ("Reapply [IR] Don't accept nullptr as GEP element type", 2021-07-09).
1 parent d993887 commit c8aaa5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/SPIRV/SPIRVReader.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,18 +2378,19 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
23782378
case OpInBoundsPtrAccessChain: {
23792379
auto AC = static_cast<SPIRVAccessChainBase *>(BV);
23802380
auto Base = transValue(AC->getBase(), F, BB);
2381+
Type *BaseTy = cast<PointerType>(Base->getType())->getPointerElementType();
23812382
auto Index = transValue(AC->getIndices(), F, BB);
23822383
if (!AC->hasPtrIndex())
23832384
Index.insert(Index.begin(), getInt32(M, 0));
23842385
auto IsInbound = AC->isInBounds();
23852386
Value *V = nullptr;
23862387
if (BB) {
23872388
auto GEP =
2388-
GetElementPtrInst::Create(nullptr, Base, Index, BV->getName(), BB);
2389+
GetElementPtrInst::Create(BaseTy, Base, Index, BV->getName(), BB);
23892390
GEP->setIsInBounds(IsInbound);
23902391
V = GEP;
23912392
} else {
2392-
V = ConstantExpr::getGetElementPtr(nullptr, dyn_cast<Constant>(Base),
2393+
V = ConstantExpr::getGetElementPtr(BaseTy, dyn_cast<Constant>(Base),
23932394
Index, IsInbound);
23942395
}
23952396
return mapValue(BV, V);

0 commit comments

Comments
 (0)