coverage. Disable supporting mcdc on llvm-18
This commit is contained in:
parent
3ae715c8c6
commit
911ac56e95
13 changed files with 38 additions and 54 deletions
|
@ -1683,6 +1683,11 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||||
) {
|
) {
|
||||||
debug!("mcdc_parameters() with args ({:?}, {:?}, {:?})", fn_name, hash, bitmap_bytes);
|
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 llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCParametersIntrinsic(self.cx().llmod) };
|
||||||
let llty = self.cx.type_func(
|
let llty = self.cx.type_func(
|
||||||
&[self.cx.type_ptr(), self.cx.type_i64(), self.cx.type_i32()],
|
&[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 ({:?}, {:?}, {:?}, {:?}, {:?})",
|
"mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
|
||||||
fn_name, hash, bitmap_bytes, bitmap_index, mcdc_temp
|
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 =
|
let llfn =
|
||||||
unsafe { llvm::LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(self.cx().llmod) };
|
unsafe { llvm::LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(self.cx().llmod) };
|
||||||
|
@ -1757,6 +1766,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||||
"mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
|
"mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
|
||||||
fn_name, hash, cond_loc, mcdc_temp, bool_value
|
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 llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCCondBitmapIntrinsic(self.cx().llmod) };
|
||||||
let llty = self.cx.type_func(
|
let llty = self.cx.type_func(
|
||||||
&[
|
&[
|
||||||
|
|
|
@ -88,38 +88,7 @@ struct LLVMRustMCDCParameters {
|
||||||
LLVMRustMCDCBranchParameters BranchParameters;
|
LLVMRustMCDCBranchParameters BranchParameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
// LLVM representations for `MCDCParameters` evolved from LLVM 18 to 19.
|
#if LLVM_VERSION_GE(19, 0)
|
||||||
// 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
|
|
||||||
static coverage::mcdc::Parameters fromRust(LLVMRustMCDCParameters Params) {
|
static coverage::mcdc::Parameters fromRust(LLVMRustMCDCParameters Params) {
|
||||||
switch (Params.Tag) {
|
switch (Params.Tag) {
|
||||||
case LLVMRustMCDCParametersTag::None:
|
case LLVMRustMCDCParametersTag::None:
|
||||||
|
@ -214,13 +183,17 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer(
|
||||||
RustMappingRegions, NumMappingRegions)) {
|
RustMappingRegions, NumMappingRegions)) {
|
||||||
MappingRegions.emplace_back(
|
MappingRegions.emplace_back(
|
||||||
fromRust(Region.Count), fromRust(Region.FalseCount),
|
fromRust(Region.Count), fromRust(Region.FalseCount),
|
||||||
#if LLVM_VERSION_LT(19, 0)
|
#if LLVM_VERSION_GE(18, 0) && LLVM_VERSION_LT(19, 0)
|
||||||
// LLVM 19 may move this argument to last.
|
coverage::CounterMappingRegion::MCDCParameters{},
|
||||||
fromRust(Region.MCDCParameters),
|
|
||||||
#endif
|
#endif
|
||||||
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.
|
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.
|
||||||
Region.LineStart, Region.ColumnStart, Region.LineEnd, Region.ColumnEnd,
|
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;
|
std::vector<coverage::CounterExpression> Expressions;
|
||||||
|
|
|
@ -1539,23 +1539,21 @@ LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M) {
|
||||||
|
|
||||||
extern "C" LLVMValueRef
|
extern "C" LLVMValueRef
|
||||||
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
|
LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
|
||||||
|
#if LLVM_VERSION_GE(19, 0)
|
||||||
return wrap(llvm::Intrinsic::getDeclaration(
|
return wrap(llvm::Intrinsic::getDeclaration(
|
||||||
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
|
unwrap(M), llvm::Intrinsic::instrprof_mcdc_parameters));
|
||||||
|
#else
|
||||||
|
report_fatal_error("LLVM 19.0 is required for mcdc intrinsic functions");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" LLVMValueRef
|
extern "C" LLVMValueRef
|
||||||
LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
|
LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
|
||||||
|
#if LLVM_VERSION_GE(19, 0)
|
||||||
return wrap(llvm::Intrinsic::getDeclaration(
|
return wrap(llvm::Intrinsic::getDeclaration(
|
||||||
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
|
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
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LL| |#![feature(coverage_attribute)]
|
LL| |#![feature(coverage_attribute)]
|
||||||
LL| |//@ edition: 2021
|
LL| |//@ edition: 2021
|
||||||
LL| |//@ ignore-llvm-version: 19 - 99
|
LL| |//@ min-llvm-version: 19
|
||||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
LL| |
|
LL| |
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ ignore-llvm-version: 19 - 99
|
//@ min-llvm-version: 19
|
||||||
//@ compile-flags: -Zcoverage-options=mcdc
|
//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LL| |#![feature(coverage_attribute)]
|
LL| |#![feature(coverage_attribute)]
|
||||||
LL| |//@ edition: 2021
|
LL| |//@ edition: 2021
|
||||||
LL| |//@ ignore-llvm-version: 19 - 99
|
LL| |//@ min-llvm-version: 19
|
||||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
LL| |
|
LL| |
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ ignore-llvm-version: 19 - 99
|
//@ min-llvm-version: 19
|
||||||
//@ compile-flags: -Zcoverage-options=mcdc
|
//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LL| |#![feature(coverage_attribute)]
|
LL| |#![feature(coverage_attribute)]
|
||||||
LL| |//@ edition: 2021
|
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| |//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0
|
||||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
LL| |
|
LL| |
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ ignore-llvm-version: 19 - 99
|
//@ min-llvm-version: 19
|
||||||
//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0
|
//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0
|
||||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LL| |#![feature(coverage_attribute)]
|
LL| |#![feature(coverage_attribute)]
|
||||||
LL| |//@ edition: 2021
|
LL| |//@ edition: 2021
|
||||||
LL| |//@ ignore-llvm-version: 19 - 99
|
LL| |//@ min-llvm-version: 19
|
||||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
LL| |
|
LL| |
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ ignore-llvm-version: 19 - 99
|
//@ min-llvm-version: 19
|
||||||
//@ compile-flags: -Zcoverage-options=mcdc
|
//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LL| |#![feature(coverage_attribute)]
|
LL| |#![feature(coverage_attribute)]
|
||||||
LL| |//@ edition: 2021
|
LL| |//@ edition: 2021
|
||||||
LL| |//@ ignore-llvm-version: 19 - 99
|
LL| |//@ min-llvm-version: 19
|
||||||
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
LL| |//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
LL| |
|
LL| |
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ ignore-llvm-version: 19 - 99
|
//@ min-llvm-version: 19
|
||||||
//@ compile-flags: -Zcoverage-options=mcdc
|
//@ compile-flags: -Zcoverage-options=mcdc
|
||||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue