Skip to content

Commit 8096840

Browse files
committed
[LLVM 21] Use Intrinsic::getOrInsertDeclaration
1 parent 4a117a0 commit 8096840

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gen/variable_lifetime.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ llvm::Function *LocalVariableLifetimeAnnotator::getLLVMLifetimeStartFn() {
7878
if (lifetimeStartFunction)
7979
return lifetimeStartFunction;
8080

81-
lifetimeStartFunction = llvm::Intrinsic::getDeclaration(
81+
lifetimeStartFunction = llvm::Intrinsic::
82+
#if LDC_LLVM_VER >= 2100
83+
getOrInsertDeclaration(
84+
#else
85+
getDeclaration(
86+
#endif
8287
&irs.module, llvm::Intrinsic::lifetime_start, allocaType);
8388
assert(lifetimeStartFunction);
8489
return lifetimeStartFunction;
@@ -89,7 +94,12 @@ llvm::Function *LocalVariableLifetimeAnnotator::getLLVMLifetimeEndFn() {
8994
if (lifetimeEndFunction)
9095
return lifetimeEndFunction;
9196

92-
lifetimeEndFunction = llvm::Intrinsic::getDeclaration(
97+
lifetimeEndFunction = llvm::Intrinsic::
98+
#if LDC_LLVM_VER >= 2100
99+
getOrInsertDeclaration(
100+
#else
101+
getDeclaration(
102+
#endif
93103
&irs.module, llvm::Intrinsic::lifetime_end, allocaType);
94104
assert(lifetimeEndFunction);
95105
return lifetimeEndFunction;

0 commit comments

Comments
 (0)