Skip to content

Commit 19345d5

Browse files
committed
RustWrapper: adapt for rename of Intrinsic::getDeclaration
llvm/llvm-project@fa789df renamed getDeclaration to getOrInsertDeclaration. @rustbot label: +llvm-main
1 parent 484c8e7 commit 19345d5

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+19-6
Original file line numberDiff line numberDiff line change
@@ -1533,27 +1533,40 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty,
15331533

15341534
extern "C" LLVMValueRef
15351535
LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) {
1536+
#if LLVM_VERSION_GE(20, 0)
1537+
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
1538+
unwrap(M), llvm::Intrinsic::instrprof_increment));
1539+
#else
15361540
return wrap(llvm::Intrinsic::getDeclaration(
15371541
unwrap(M), llvm::Intrinsic::instrprof_increment));
1542+
#endif
15381543
}
15391544

15401545
extern "C" LLVMValueRef
15411546
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
1542-
#if LLVM_VERSION_GE(19, 0)
1543-
return wrap(llvm::Intrinsic::getDeclaration(
1547+
#if LLVM_VERSION_LT(19, 0)
1548+
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
1549+
#endif
1550+
#if LLVM_VERSION_GE(20, 0)
1551+
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
15441552
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
15451553
#else
1546-
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
1554+
return wrap(llvm::Intrinsic::getDeclaration(
1555+
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
15471556
#endif
15481557
}
15491558

15501559
extern "C" LLVMValueRef
15511560
LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
1552-
#if LLVM_VERSION_GE(19, 0)
1553-
return wrap(llvm::Intrinsic::getDeclaration(
1561+
#if LLVM_VERSION_LT(19, 0)
1562+
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
1563+
#endif
1564+
#if LLVM_VERSION_GE(20, 0)
1565+
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
15541566
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
15551567
#else
1556-
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
1568+
return wrap(llvm::Intrinsic::getDeclaration(
1569+
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
15571570
#endif
15581571
}
15591572

0 commit comments

Comments
 (0)