Skip to content

Commit

Permalink
Rollup merge of #131552 - durin42:llvm-20-getOrInsertDeclaration, r=c…
Browse files Browse the repository at this point in the history
…uviper

RustWrapper: adapt for rename of Intrinsic::getDeclaration

llvm/llvm-project@fa789df renamed getDeclaration to getOrInsertDeclaration.

`@rustbot` label: +llvm-main
  • Loading branch information
tgross35 authored Oct 11, 2024
2 parents 2c385ba + 19345d5 commit 6f76d6e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,27 +1533,40 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty,

extern "C" LLVMValueRef
LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) {
#if LLVM_VERSION_GE(20, 0)
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_increment));
#else
return wrap(llvm::Intrinsic::getDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_increment));
#endif
}

extern "C" LLVMValueRef
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
#if LLVM_VERSION_GE(19, 0)
return wrap(llvm::Intrinsic::getDeclaration(
#if LLVM_VERSION_LT(19, 0)
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
#endif
#if LLVM_VERSION_GE(20, 0)
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
#else
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
return wrap(llvm::Intrinsic::getDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
#endif
}

extern "C" LLVMValueRef
LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
#if LLVM_VERSION_GE(19, 0)
return wrap(llvm::Intrinsic::getDeclaration(
#if LLVM_VERSION_LT(19, 0)
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
#endif
#if LLVM_VERSION_GE(20, 0)
return wrap(llvm::Intrinsic::getOrInsertDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
#else
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
return wrap(llvm::Intrinsic::getDeclaration(
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
#endif
}

Expand Down

0 comments on commit 6f76d6e

Please sign in to comment.