Skip to content

Commit c9a0b93

Browse files
author
zhuyunxing
committed
coverage. Allow to be compiled on llvm-17
1 parent 435dc44 commit c9a0b93

File tree

9 files changed

+89
-60
lines changed

9 files changed

+89
-60
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
12481248
) -> &'ll Value {
12491249
debug!("mcdc_parameters() with args ({:?}, {:?}, {:?})", fn_name, hash, bitmap_bytes);
12501250

1251+
assert!(llvm_util::get_version() >= (18, 0, 0), "MCDC intrinsics require LLVM 18 or later");
1252+
12511253
let llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCParametersIntrinsic(self.cx().llmod) };
12521254
let llty = self.cx.type_func(
12531255
&[self.cx.type_ptr(), self.cx.type_i64(), self.cx.type_i32()],
@@ -1292,6 +1294,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
12921294
"mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
12931295
fn_name, hash, bitmap_bytes, bitmap_index, mcdc_temp
12941296
);
1297+
assert!(llvm_util::get_version() >= (18, 0, 0), "MCDC intrinsics require LLVM 18 or later");
12951298

12961299
let llfn =
12971300
unsafe { llvm::LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(self.cx().llmod) };
@@ -1328,6 +1331,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
13281331
mcdc_temp: Self::Value,
13291332
bool_value: Self::Value,
13301333
) {
1334+
debug!(
1335+
"mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})",
1336+
fn_name, hash, cond_loc, mcdc_temp, bool_value
1337+
);
1338+
assert!(llvm_util::get_version() >= (18, 0, 0), "MCDC intrinsics require LLVM 18 or later");
13311339
let llfn = unsafe { llvm::LLVMRustGetInstrProfMCDCCondBitmapIntrinsic(self.cx().llmod) };
13321340
let llty = self.cx.type_func(
13331341
&[

compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::coverageinfo::ffi::{Counter, CounterExpression, ExprKind};
2+
23
use rustc_data_structures::captures::Captures;
34
use rustc_data_structures::fx::FxIndexSet;
45
use rustc_index::bit_set::BitSet;
@@ -73,7 +74,6 @@ impl<'tcx> FunctionCoverageCollector<'tcx> {
7374
Self {
7475
function_coverage_info,
7576
is_used,
76-
7777
counters_seen: BitSet::new_empty(num_counters),
7878
expressions_seen,
7979
}

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,17 @@ fromRust(LLVMRustCounterMappingRegionKind Kind) {
5858
return coverage::CounterMappingRegion::GapRegion;
5959
case LLVMRustCounterMappingRegionKind::BranchRegion:
6060
return coverage::CounterMappingRegion::BranchRegion;
61+
#if LLVM_VERSION_GE(18, 0)
6162
case LLVMRustCounterMappingRegionKind::MCDCDecisionRegion:
6263
return coverage::CounterMappingRegion::MCDCDecisionRegion;
6364
case LLVMRustCounterMappingRegionKind::MCDCBranchRegion:
6465
return coverage::CounterMappingRegion::MCDCBranchRegion;
66+
#else
67+
case LLVMRustCounterMappingRegionKind::MCDCDecisionRegion:
68+
break;
69+
case LLVMRustCounterMappingRegionKind::MCDCBranchRegion:
70+
break;
71+
#endif
6572
}
6673
report_fatal_error("Bad LLVMRustCounterMappingRegionKind!");
6774
}

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,18 +1547,30 @@ extern "C" LLVMValueRef LLVMRustGetInstrProfIncrementIntrinsic(LLVMModuleRef M)
15471547
}
15481548

15491549
extern "C" LLVMValueRef LLVMRustGetInstrProfMCDCParametersIntrinsic(LLVMModuleRef M) {
1550+
#if LLVM_VERSION_GE(18, 0)
15501551
return wrap(llvm::Intrinsic::getDeclaration(unwrap(M),
15511552
(llvm::Intrinsic::ID)llvm::Intrinsic::instrprof_mcdc_parameters));
1553+
#else
1554+
report_fatal_error("LLVM 18.0 is required for mcdc intrinsic functions");
1555+
#endif
15521556
}
15531557

15541558
extern "C" LLVMValueRef LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic(LLVMModuleRef M) {
1555-
return wrap(llvm::Intrinsic::getDeclaration(unwrap(M),
1556-
(llvm::Intrinsic::ID)llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
1559+
#if LLVM_VERSION_GE(18, 0)
1560+
return wrap(llvm::Intrinsic::getDeclaration(
1561+
unwrap(M), llvm::Intrinsic::instrprof_mcdc_tvbitmap_update));
1562+
#else
1563+
report_fatal_error("LLVM 18.0 is required for mcdc intrinsic functions");
1564+
#endif
15571565
}
15581566

15591567
extern "C" LLVMValueRef LLVMRustGetInstrProfMCDCCondBitmapIntrinsic(LLVMModuleRef M) {
1560-
return wrap(llvm::Intrinsic::getDeclaration(unwrap(M),
1561-
(llvm::Intrinsic::ID)llvm::Intrinsic::instrprof_mcdc_condbitmap_update));
1568+
#if LLVM_VERSION_GE(18, 0)
1569+
return wrap(llvm::Intrinsic::getDeclaration(
1570+
unwrap(M), llvm::Intrinsic::instrprof_mcdc_condbitmap_update));
1571+
#else
1572+
report_fatal_error("LLVM 18.0 is required for mcdc intrinsic functions");
1573+
#endif
15621574
}
15631575

15641576
extern "C" LLVMValueRef LLVMRustBuildMemCpy(LLVMBuilderRef B,

compiler/rustc_mir_build/src/build/coverageinfo.rs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -192,46 +192,46 @@ impl MCDCState {
192192
.then(|| Self { decision_stack: VecDeque::new(), processing_decision: None })
193193
}
194194

195-
/// At first we assign ConditionIds for each sub expression.
196-
/// If the sub expression is composite, re-assign its ConditionId to its LHS and generate a new ConditionId for its RHS.
197-
///
198-
/// Example: "x = (A && B) || (C && D) || (D && F)"
199-
///
200-
/// Visit Depth1:
201-
/// (A && B) || (C && D) || (D && F)
202-
/// ^-------LHS--------^ ^-RHS--^
203-
/// ID=1 ID=2
204-
///
205-
/// Visit LHS-Depth2:
206-
/// (A && B) || (C && D)
207-
/// ^-LHS--^ ^-RHS--^
208-
/// ID=1 ID=3
209-
///
210-
/// Visit LHS-Depth3:
211-
/// (A && B)
212-
/// LHS RHS
213-
/// ID=1 ID=4
214-
///
215-
/// Visit RHS-Depth3:
216-
/// (C && D)
217-
/// LHS RHS
218-
/// ID=3 ID=5
219-
///
220-
/// Visit RHS-Depth2: (D && F)
221-
/// LHS RHS
222-
/// ID=2 ID=6
223-
///
224-
/// Visit Depth1:
225-
/// (A && B) || (C && D) || (D && F)
226-
/// ID=1 ID=4 ID=3 ID=5 ID=2 ID=6
227-
///
228-
/// A node ID of '0' always means MC/DC isn't being tracked.
229-
///
230-
/// If a "next" node ID is '0', it means it's the end of the test vector.
231-
///
232-
/// As the compiler tracks expression in pre-order, we can ensure that condition info of parents are always properly assigned when their children are visited.
233-
/// - If the op is AND, the "false_next" of LHS and RHS should be the parent's "false_next". While "true_next" of the LHS is the RHS, the "true next" of RHS is the parent's "true_next".
234-
/// - If the op is OR, the "true_next" of LHS and RHS should be the parent's "true_next". While "false_next" of the LHS is the RHS, the "false next" of RHS is the parent's "false_next".
195+
// At first we assign ConditionIds for each sub expression.
196+
// If the sub expression is composite, re-assign its ConditionId to its LHS and generate a new ConditionId for its RHS.
197+
//
198+
// Example: "x = (A && B) || (C && D) || (D && F)"
199+
//
200+
// Visit Depth1:
201+
// (A && B) || (C && D) || (D && F)
202+
// ^-------LHS--------^ ^-RHS--^
203+
// ID=1 ID=2
204+
//
205+
// Visit LHS-Depth2:
206+
// (A && B) || (C && D)
207+
// ^-LHS--^ ^-RHS--^
208+
// ID=1 ID=3
209+
//
210+
// Visit LHS-Depth3:
211+
// (A && B)
212+
// LHS RHS
213+
// ID=1 ID=4
214+
//
215+
// Visit RHS-Depth3:
216+
// (C && D)
217+
// LHS RHS
218+
// ID=3 ID=5
219+
//
220+
// Visit RHS-Depth2: (D && F)
221+
// LHS RHS
222+
// ID=2 ID=6
223+
//
224+
// Visit Depth1:
225+
// (A && B) || (C && D) || (D && F)
226+
// ID=1 ID=4 ID=3 ID=5 ID=2 ID=6
227+
//
228+
// A node ID of '0' always means MC/DC isn't being tracked.
229+
//
230+
// If a "next" node ID is '0', it means it's the end of the test vector.
231+
//
232+
// As the compiler tracks expression in pre-order, we can ensure that condition info of parents are always properly assigned when their children are visited.
233+
// - If the op is AND, the "false_next" of LHS and RHS should be the parent's "false_next". While "true_next" of the LHS is the RHS, the "true next" of RHS is the parent's "true_next".
234+
// - If the op is OR, the "true_next" of LHS and RHS should be the parent's "true_next". While "false_next" of the LHS is the RHS, the "false next" of RHS is the parent's "false_next".
235235
fn record_conditions(&mut self, op: LogicalOp, span: Span) {
236236
let decision = match self.processing_decision.as_mut() {
237237
Some(decision) => {

compiler/rustc_mir_transform/src/coverage/spans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use rustc_data_structures::graph::DirectedGraph;
2-
use std::collections::BTreeSet;
32
use rustc_index::bit_set::BitSet;
43
use rustc_middle::mir;
54
use rustc_middle::mir::coverage::ConditionInfo;
65
use rustc_span::{BytePos, Span};
6+
use std::collections::BTreeSet;
77

88
use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, START_BCB};
99
use crate::coverage::spans::from_mir::SpanFromMir;

tests/coverage/mcdc_if.cov-map

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Function name: mcdc_if::mcdc_check_a
2-
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 0e, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
2+
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 0f, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
33
Number of files: 1
44
- file 0 => global file 1
55
Number of expressions: 4
@@ -8,7 +8,7 @@ Number of expressions: 4
88
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
99
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
1010
Number of file 0 mappings: 8
11-
- Code(Counter(0)) at (prev + 14, 1) to (start + 1, 9)
11+
- Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9)
1212
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
1313
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
1414
true = c1
@@ -24,7 +24,7 @@ Number of file 0 mappings: 8
2424
= (c3 + (c2 + (c0 - c1)))
2525

2626
Function name: mcdc_if::mcdc_check_b
27-
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 16, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
27+
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 17, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
2828
Number of files: 1
2929
- file 0 => global file 1
3030
Number of expressions: 4
@@ -33,7 +33,7 @@ Number of expressions: 4
3333
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
3434
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
3535
Number of file 0 mappings: 8
36-
- Code(Counter(0)) at (prev + 22, 1) to (start + 1, 9)
36+
- Code(Counter(0)) at (prev + 23, 1) to (start + 1, 9)
3737
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
3838
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
3939
true = c1
@@ -49,7 +49,7 @@ Number of file 0 mappings: 8
4949
= (c3 + (c2 + (c0 - c1)))
5050

5151
Function name: mcdc_if::mcdc_check_both
52-
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 1e, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
52+
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 1f, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
5353
Number of files: 1
5454
- file 0 => global file 1
5555
Number of expressions: 4
@@ -58,7 +58,7 @@ Number of expressions: 4
5858
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
5959
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
6060
Number of file 0 mappings: 8
61-
- Code(Counter(0)) at (prev + 30, 1) to (start + 1, 9)
61+
- Code(Counter(0)) at (prev + 31, 1) to (start + 1, 9)
6262
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
6363
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
6464
true = c1
@@ -74,7 +74,7 @@ Number of file 0 mappings: 8
7474
= (c3 + (c2 + (c0 - c1)))
7575

7676
Function name: mcdc_if::mcdc_check_neither
77-
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 06, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
77+
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 07, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
7878
Number of files: 1
7979
- file 0 => global file 1
8080
Number of expressions: 4
@@ -83,7 +83,7 @@ Number of expressions: 4
8383
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
8484
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
8585
Number of file 0 mappings: 8
86-
- Code(Counter(0)) at (prev + 6, 1) to (start + 1, 9)
86+
- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9)
8787
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
8888
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
8989
true = c1
@@ -99,7 +99,7 @@ Number of file 0 mappings: 8
9999
= (c3 + (c2 + (c0 - c1)))
100100

101101
Function name: mcdc_if::mcdc_check_not_tree_decision
102-
Raw bytes (87): 0x[01, 01, 08, 01, 05, 02, 09, 05, 09, 0d, 1e, 02, 09, 11, 1b, 0d, 1e, 02, 09, 0a, 01, 30, 01, 03, 0a, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 1e, 03, 02, 00, 00, 0e, 00, 0f, 0b, 00, 14, 00, 15, 30, 11, 0d, 02, 00, 00, 00, 14, 00, 15, 11, 00, 16, 02, 06, 1b, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
102+
Raw bytes (87): 0x[01, 01, 08, 01, 05, 02, 09, 05, 09, 0d, 1e, 02, 09, 11, 1b, 0d, 1e, 02, 09, 0a, 01, 31, 01, 03, 0a, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 1e, 03, 02, 00, 00, 0e, 00, 0f, 0b, 00, 14, 00, 15, 30, 11, 0d, 02, 00, 00, 00, 14, 00, 15, 11, 00, 16, 02, 06, 1b, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
103103
Number of files: 1
104104
- file 0 => global file 1
105105
Number of expressions: 8
@@ -112,7 +112,7 @@ Number of expressions: 8
112112
- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Sub)
113113
- expression 7 operands: lhs = Expression(0, Sub), rhs = Counter(2)
114114
Number of file 0 mappings: 10
115-
- Code(Counter(0)) at (prev + 48, 1) to (start + 3, 10)
115+
- Code(Counter(0)) at (prev + 49, 1) to (start + 3, 10)
116116
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
117117
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 3 } at (prev + 0, 9) to (start + 0, 10)
118118
true = c1
@@ -134,7 +134,7 @@ Number of file 0 mappings: 10
134134
= (c4 + (c3 + ((c0 - c1) - c2)))
135135

136136
Function name: mcdc_if::mcdc_check_tree_decision
137-
Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 0d, 05, 0d, 0d, 11, 09, 02, 1b, 1f, 0d, 11, 09, 02, 0a, 01, 26, 01, 03, 09, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 0d, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 11, 09, 03, 00, 00, 00, 13, 00, 14, 1b, 00, 16, 02, 06, 1f, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
137+
Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 0d, 05, 0d, 0d, 11, 09, 02, 1b, 1f, 0d, 11, 09, 02, 0a, 01, 27, 01, 03, 09, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 0d, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 11, 09, 03, 00, 00, 00, 13, 00, 14, 1b, 00, 16, 02, 06, 1f, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
138138
Number of files: 1
139139
- file 0 => global file 1
140140
Number of expressions: 8
@@ -147,7 +147,7 @@ Number of expressions: 8
147147
- expression 6 operands: lhs = Counter(3), rhs = Counter(4)
148148
- expression 7 operands: lhs = Counter(2), rhs = Expression(0, Sub)
149149
Number of file 0 mappings: 10
150-
- Code(Counter(0)) at (prev + 38, 1) to (start + 3, 9)
150+
- Code(Counter(0)) at (prev + 39, 1) to (start + 3, 9)
151151
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
152152
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
153153
true = c1
@@ -169,7 +169,7 @@ Number of file 0 mappings: 10
169169
= ((c3 + c4) + (c2 + (c0 - c1)))
170170

171171
Function name: mcdc_if::mcdc_nested_if
172-
Raw bytes (124): 0x[01, 01, 0d, 01, 05, 02, 09, 05, 09, 1b, 15, 05, 09, 1b, 15, 05, 09, 11, 15, 02, 09, 2b, 32, 0d, 2f, 11, 15, 02, 09, 0e, 01, 3a, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 32, 02, 00, 00, 00, 0d, 00, 0e, 1b, 01, 09, 01, 0d, 28, 01, 02, 01, 0c, 00, 12, 30, 16, 15, 01, 02, 00, 00, 0c, 00, 0d, 16, 00, 11, 00, 12, 30, 0d, 11, 02, 00, 00, 00, 11, 00, 12, 0d, 00, 13, 02, 0a, 2f, 02, 0a, 00, 0b, 32, 01, 0c, 02, 06, 27, 03, 01, 00, 02]
172+
Raw bytes (124): 0x[01, 01, 0d, 01, 05, 02, 09, 05, 09, 1b, 15, 05, 09, 1b, 15, 05, 09, 11, 15, 02, 09, 2b, 32, 0d, 2f, 11, 15, 02, 09, 0e, 01, 3b, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 32, 02, 00, 00, 00, 0d, 00, 0e, 1b, 01, 09, 01, 0d, 28, 01, 02, 01, 0c, 00, 12, 30, 16, 15, 01, 02, 00, 00, 0c, 00, 0d, 16, 00, 11, 00, 12, 30, 0d, 11, 02, 00, 00, 00, 11, 00, 12, 0d, 00, 13, 02, 0a, 2f, 02, 0a, 00, 0b, 32, 01, 0c, 02, 06, 27, 03, 01, 00, 02]
173173
Number of files: 1
174174
- file 0 => global file 1
175175
Number of expressions: 13
@@ -187,7 +187,7 @@ Number of expressions: 13
187187
- expression 11 operands: lhs = Counter(4), rhs = Counter(5)
188188
- expression 12 operands: lhs = Expression(0, Sub), rhs = Counter(2)
189189
Number of file 0 mappings: 14
190-
- Code(Counter(0)) at (prev + 58, 1) to (start + 1, 9)
190+
- Code(Counter(0)) at (prev + 59, 1) to (start + 1, 9)
191191
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
192192
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 8) to (start + 0, 9)
193193
true = c1

tests/coverage/mcdc_if.coverage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
LL| |#![feature(coverage_attribute)]
22
LL| |//@ edition: 2021
3+
LL| |//@ min-llvm-version: 18
34
LL| |//@ compile-flags: -Zcoverage-options=mcdc
45
LL| |//@ llvm-cov-flags: --show-mcdc
56
LL| |

tests/coverage/mcdc_if.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(coverage_attribute)]
22
//@ edition: 2021
3+
//@ min-llvm-version: 18
34
//@ compile-flags: -Zcoverage-options=mcdc
45
//@ llvm-cov-flags: --show-mcdc
56

0 commit comments

Comments
 (0)