Skip to content

Commit b203279

Browse files
authored
Rollup merge of rust-lang#111469 - Dushistov:fix-coverage-data-race, r=wesleywiser
Fix data race in llvm source code coverage Fixes rust-lang#91092 . Before this patch, increment of counters for code coverage looks like this: ``` movq .L__profc__RNvCsd6wgJFC5r19_3lib6bugaga+8(%rip), %rax addq $1, %rax movq %rax, .L__profc__RNvCsd6wgJFC5r19_3lib6bugaga+8(%rip) ``` after this patch: ``` lock incq .L__profc__RNvCs3JgIB2SjHh2_3lib6bugaga+8(%rip) ```
2 parents ae2f6f2 + 90ce53a commit b203279

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,9 @@ LLVMRustOptimize(
745745
if (InstrProfileOutput) {
746746
Options.InstrProfileOutput = InstrProfileOutput;
747747
}
748+
// cargo run tests in multhreading mode by default
749+
// so use atomics for coverage counters
750+
Options.Atomic = true;
748751
MPM.addPass(InstrProfiling(Options, false));
749752
}
750753
);

0 commit comments

Comments
 (0)