Skip to content

Commit

Permalink
Change PassWrapper.cpp to not emit Atomic operations on 32 bit platfo…
Browse files Browse the repository at this point in the history
…rms.
  • Loading branch information
SeanMollet committed Jul 8, 2023
1 parent 921f669 commit 64b932d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,14 +740,18 @@ LLVMRustOptimize(

if (InstrumentCoverage) {
PipelineStartEPCallbacks.push_back(
[InstrProfileOutput](ModulePassManager &MPM, OptimizationLevel Level) {
[InstrProfileOutput, TargetTriple](ModulePassManager &MPM, OptimizationLevel Level) {
InstrProfOptions Options;
if (InstrProfileOutput) {
Options.InstrProfileOutput = InstrProfileOutput;
}
// cargo run tests in multhreading mode by default
// so use atomics for coverage counters
Options.Atomic = true;
// This only works on platforms that support 64 bit atomic operations
// So, don't do it on 32 bit platforms
if (TargetTriple.isArch64Bit()){
Options.Atomic = true;
}
MPM.addPass(InstrProfiling(Options, false));
}
);
Expand Down

0 comments on commit 64b932d

Please sign in to comment.