@@ -1533,27 +1533,40 @@ extern "C" LLVMValueRef LLVMRustBuildCall(LLVMBuilderRef B, LLVMTypeRef Ty,
1533
1533
1534
1534
extern " C" LLVMValueRef
1535
1535
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
1536
1540
return wrap (llvm::Intrinsic::getDeclaration (
1537
1541
unwrap (M), llvm::Intrinsic::instrprof_increment));
1542
+ #endif
1538
1543
}
1539
1544
1540
1545
extern " C" LLVMValueRef
1541
1546
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 (
1544
1552
unwrap (M), llvm::Intrinsic::instrprof_mcdc_parameters));
1545
1553
#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));
1547
1556
#endif
1548
1557
}
1549
1558
1550
1559
extern " C" LLVMValueRef
1551
1560
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 (
1554
1566
unwrap (M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
1555
1567
#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));
1557
1570
#endif
1558
1571
}
1559
1572
0 commit comments