Repository navigation
Conversation
|
Some changes occurred in coverage instrumentation. cc @Zalathar Some changes occurred in match lowering cc @Nadrieril Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in coverage instrumentation. cc @Zalathar Some changes occurred in coverage tests. cc @Zalathar Some changes occurred in coverage instrumentation. cc @Zalathar Some changes occurred in coverage instrumentation. cc @Zalathar |
This comment has been minimized.
This comment has been minimized.
2c18611 to
a0fc461
Compare
a0fc461 to
fbe7282
Compare
This comment has been minimized.
This comment has been minimized.
fbe7282 to
4629398
Compare
This comment has been minimized.
This comment has been minimized.
Currently, passing the `coverage-options=mcdc` disables inlining entirely. A better way to achieve this would be to only prevent functions with MC/DC instrumentation from inlining.
mcdc-cov(codegen): Introduce codegen llvm instructions
Add `init_coverage` function to CoverageInfoBuilderMethods trait. It is implemented by LLVM codegen to allocate the temporary variables necessary to track MC/DC decisions evaluation.
4629398 to
1f916c0
Compare
|
☔ The latest upstream changes (presumably #162009) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
|
TLDR: with this stack, llvm-cov crashes (SIGILL in CoverageMapping::loadFunctionRecord) on binaries containing a matches! used as a condition inside a &&/|| decision. The same logic written as (v == 1 || v == 2) works. Reproducer (repro.rs): fn f(a: bool, v: u8, t: bool) -> bool {
!a && matches!(v, 1 | 2) && t
}
fn main() {
for (a, v, t) in [(false,1,true), (true,1,true), (false,3,true), (false,2,false)] {
std::hint::black_box(f(a,v,t));
}
}Control: replacing matches!(v, 1 | 2) with (v == 1 || v == 2) gives exit code 0 and a normal MC/DC decision report. Stack trace: #3 llvm::coverage::CoverageMapping::loadFunctionRecord(llvm::coverage::CoverageMappingRecord
const&, std::optional<std::reference_wrapper<llvm::IndexedInstrProfReader>>
const&) (libLLVM.so.22.1-rust-1.99.0-nightly+0x825e026)
#4 llvm::coverage::CoverageMapping::loadFromReaders(...) (libLLVM.so.22.1-
rust-1.99.0-nightly+0x825e3fa)
#5 llvm::coverage::CoverageMapping::loadFromFile(...) (libLLVM.so.22.1-
rust-1.99.0-nightly+0x825e8d1)
#6 llvm::coverage::CoverageMapping::load(...) (libLLVM.so.22.1-rust-1.99.
0-nightly+0x825ee6d)
#7 (anonymous namespace)::CodeCoverageTool::load() CodeCoverage.cpp:0:0
#8 (anonymous namespace)::CodeCoverageTool::run(...) CodeCoverage.cpp:0:0
#9 showMain(int, char const**) (llvm-cov+0x19d4a) Notes:
Question: |
Follow-up of #161223
Tracking issue: rust-lang/goals#638
Finalize MC/DC implementation for boolean expressions.
r? @davidtwco