Skip to content

Commit d72e1e8

Browse files
author
Colin Davidson
committed
[LLVM Tip][SPIRV-LL] Fix Lifetime failure with llvm tip
IRBuilder::CreateLifetimeStart has been changed to drop the size parameter and instead work out what it needs to.
1 parent 2f57e8d commit d72e1e8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

modules/compiler/spirv-ll/source/builder_core.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5944,15 +5944,18 @@ llvm::Error Builder::create<OpLifetimeStart>(const OpLifetimeStart *op) {
59445944
auto pointer = module.getValue(op->Pointer());
59455945
SPIRV_LL_ASSERT_PTR(pointer);
59465946

5947+
#if LLVM_VERSION_GREATER_EQUAL(22, 0)
5948+
IRBuilder.CreateLifetimeStart(pointer);
5949+
#else
59475950
const uint32_t size = op->Size();
59485951

59495952
// IRBuilder handles size == nullptr as size of variable.
59505953
llvm::ConstantInt *sizeConstant = nullptr;
59515954
if (size > 0) {
59525955
sizeConstant = IRBuilder.getInt64(size);
59535956
}
5954-
59555957
IRBuilder.CreateLifetimeStart(pointer, sizeConstant);
5958+
#endif
59565959
return llvm::Error::success();
59575960
}
59585961

@@ -5961,15 +5964,18 @@ llvm::Error Builder::create<OpLifetimeStop>(const OpLifetimeStop *op) {
59615964
auto pointer = module.getValue(op->Pointer());
59625965
SPIRV_LL_ASSERT_PTR(pointer);
59635966

5967+
#if LLVM_VERSION_GREATER_EQUAL(22, 0)
5968+
IRBuilder.CreateLifetimeEnd(pointer);
5969+
#else
59645970
const uint32_t size = op->Size();
59655971

59665972
// IRBuilder handles size == nullptr as size of variable.
59675973
llvm::ConstantInt *sizeConstant = nullptr;
59685974
if (size > 0) {
59695975
sizeConstant = IRBuilder.getInt64(size);
59705976
}
5971-
59725977
IRBuilder.CreateLifetimeEnd(pointer, sizeConstant);
5978+
#endif
59735979
return llvm::Error::success();
59745980
}
59755981

0 commit comments

Comments
 (0)