mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
coverage. Disable supporting mcdc on llvm-18
This commit is contained in:
parent
3ae715c8c6
commit
911ac56e95
@ -1683,6 +1683,11 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||
) {
|
||||
debug!("mcdc_parameters() with args ({:?}, {:?}, {:?})", fn_name, hash, bitmap_bytes);
|
||||
|
||||
assert!(
|
||||
crate::llvm_util::get_version() >= (19, 0, 0),
|
||||
"MCDC intrinsics require LLVM 19 or later"
|
||||
);
|
||||
|
||||
let llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCParametersIntrinsic(self.cx().llmod) };
|
||||
let llty = self.cx.type_func(
|
||||
&[self.cx.type_ptr(), self.cx.type_i64(), self.cx.type_i32()],
|
||||
@ -1716,6 +1721,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||
"mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
|
||||
fn_name, hash, bitmap_bytes, bitmap_index, mcdc_temp
|
||||
);
|
||||
assert!(
|
||||
crate::llvm_util::get_version() >= (19, 0, 0),
|
||||
"MCDC intrinsics require LLVM 19 or later"
|
||||
);
|
||||
|
||||
let llfn =
|
||||
unsafe { llvm::LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(self.cx().llmod) };
|
||||
@ -1757,6 +1766,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||
"mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
|
||||
fn_name, hash, cond_loc, mcdc_temp, bool_value
|
||||
);
|
||||
assert!(
|
||||
crate::llvm_util::get_version() >= (19, 0, 0),
|
||||
"MCDC intrinsics require LLVM 19 or later"
|
||||
);
|
||||
let llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCCondBitmapIntrinsic(self.cx().llmod) };
|
||||
let llty = self.cx.type_func(
|
||||
&[
|
||||
|
@ -88,38 +88,7 @@ struct LLVMRustMCDCParameters {
|
||||
LLVMRustMCDCBranchParameters BranchParameters;
|
||||
};
|
||||
|
||||
// LLVM representations for `MCDCParameters` evolved from LLVM 18 to 19.
|
||||
// Look at representations in 18
|
||||
// https://github.com/rust-lang/llvm-project/blob/66a2881a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L253-L263
|
||||
// and representations in 19
|
||||
// https://github.com/llvm/llvm-project/blob/843cc474faefad1d639f4c44c1cf3ad7dbda76c8/llvm/include/llvm/ProfileData/Coverage/MCDCTypes.h
|
||||
#if LLVM_VERSION_LT(19, 0)
|
||||
static coverage::CounterMappingRegion::MCDCParameters
|
||||
fromRust(LLVMRustMCDCParameters Params) {
|
||||
auto parameter = coverage::CounterMappingRegion::MCDCParameters{};
|
||||
switch (Params.Tag) {
|
||||
case LLVMRustMCDCParametersTag::None:
|
||||
return parameter;
|
||||
case LLVMRustMCDCParametersTag::Decision:
|
||||
parameter.BitmapIdx =
|
||||
static_cast<unsigned>(Params.DecisionParameters.BitmapIdx),
|
||||
parameter.NumConditions =
|
||||
static_cast<unsigned>(Params.DecisionParameters.NumConditions);
|
||||
return parameter;
|
||||
case LLVMRustMCDCParametersTag::Branch:
|
||||
parameter.ID = static_cast<coverage::CounterMappingRegion::MCDCConditionID>(
|
||||
Params.BranchParameters.ConditionID),
|
||||
parameter.FalseID =
|
||||
static_cast<coverage::CounterMappingRegion::MCDCConditionID>(
|
||||
Params.BranchParameters.ConditionIDs[0]),
|
||||
parameter.TrueID =
|
||||
static_cast<coverage::CounterMappingRegion::MCDCConditionID>(
|
||||
Params.BranchParameters.ConditionIDs[1]);
|
||||
return parameter;
|
||||
}
|
||||
report_fatal_error("Bad LLVMRustMCDCParametersTag!");
|
||||
}
|
||||
#else
|
||||
#if LLVM_VERSION_GE(19, 0)
|
||||
static coverage::mcdc::Parameters fromRust(LLVMRustMCDCParameters Params) {
|
||||
switch (Params.Tag) {
|
||||
case LLVMRustMCDCParametersTag::None:
|
||||
@ -214,13 +183,17 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer(
|
||||
RustMappingRegions, NumMappingRegions)) {
|
||||
MappingRegions.emplace_back(
|
||||
fromRust(Region.Count), fromRust(Region.FalseCount),
|
||||
#if LLVM_VERSION_LT(19, 0)
|
||||
// LLVM 19 may move this argument to last.
|
||||
fromRust(Region.MCDCParameters),
|
||||
#if LLVM_VERSION_GE(18, 0) && LLVM_VERSION_LT(19, 0)
|
||||
coverage::CounterMappingRegion::MCDCParameters{},
|
||||
#endif
|
||||
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.
|
||||
Region.LineStart, Region.ColumnStart, Region.LineEnd, Region.ColumnEnd,
|
||||
fromRust(Region.Kind));
|
||||
fromRust(Region.Kind)
|
||||
#if LLVM_VERSION_GE(19, 0)
|
||||
,
|
||||
fromRust(Region.MCDCParameters)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<coverage::CounterExpression> Expressions;
|
||||
|
@ -1539,23 +1539,21 @@ LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) {
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
|
||||
#if LLVM_VERSION_GE(19, 0)
|
||||
return wrap(llvm::Intrinsic::getDeclaration(
|
||||
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
|
||||
#else
|
||||
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
|
||||
#if LLVM_VERSION_GE(19, 0)
|
||||
return wrap(llvm::Intrinsic::getDeclaration(
|
||||
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustGetInstrProfMCDCCondBitmapIntrinsic(LLVMModuleRef M) {
|
||||
#if LLVM_VERSION_LT(19, 0)
|
||||
return wrap(llvm::Intrinsic::getDeclaration(
|
||||
unwrap(M), llvm::Intrinsic::instrprof_mcdc_condbitmap_update));
|
||||
#else
|
||||
report_fatal_error("LLVM 18.0 is required for mcdc intrinsic functions");
|
||||
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ ignore-llvm-version: 19 - 99
|
||||
LL| |//@ min-llvm-version: 19
|
||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
LL| |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
//@ ignore-llvm-version: 19 - 99
|
||||
//@ min-llvm-version: 19
|
||||
//@ compile-flags: -Zcoverage-options=mcdc
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ ignore-llvm-version: 19 - 99
|
||||
LL| |//@ min-llvm-version: 19
|
||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
LL| |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
//@ ignore-llvm-version: 19 - 99
|
||||
//@ min-llvm-version: 19
|
||||
//@ compile-flags: -Zcoverage-options=mcdc
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ ignore-llvm-version: 19 - 99
|
||||
LL| |//@ min-llvm-version: 19
|
||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0
|
||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
LL| |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
//@ ignore-llvm-version: 19 - 99
|
||||
//@ min-llvm-version: 19
|
||||
//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ ignore-llvm-version: 19 - 99
|
||||
LL| |//@ min-llvm-version: 19
|
||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
LL| |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
//@ ignore-llvm-version: 19 - 99
|
||||
//@ min-llvm-version: 19
|
||||
//@ compile-flags: -Zcoverage-options=mcdc
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
LL| |#![feature(coverage_attribute)]
|
||||
LL| |//@ edition: 2021
|
||||
LL| |//@ ignore-llvm-version: 19 - 99
|
||||
LL| |//@ min-llvm-version: 19
|
||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
LL| |
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
//@ ignore-llvm-version: 19 - 99
|
||||
//@ min-llvm-version: 19
|
||||
//@ compile-flags: -Zcoverage-options=mcdc
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user