Skip to content

Commit 64b932d

Browse files
committed
Change PassWrapper.cpp to not emit Atomic operations on 32 bit platforms.
1 parent 921f669 commit 64b932d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,18 @@ LLVMRustOptimize(
740740

741741
if (InstrumentCoverage) {
742742
PipelineStartEPCallbacks.push_back(
743-
[InstrProfileOutput](ModulePassManager &MPM, OptimizationLevel Level) {
743+
[InstrProfileOutput, TargetTriple](ModulePassManager &MPM, OptimizationLevel Level) {
744744
InstrProfOptions Options;
745745
if (InstrProfileOutput) {
746746
Options.InstrProfileOutput = InstrProfileOutput;
747747
}
748748
// cargo run tests in multhreading mode by default
749749
// so use atomics for coverage counters
750-
Options.Atomic = true;
750+
// This only works on platforms that support 64 bit atomic operations
751+
// So, don't do it on 32 bit platforms
752+
if (TargetTriple.isArch64Bit()){
753+
Options.Atomic = true;
754+
}
751755
MPM.addPass(InstrProfiling(Options, false));
752756
}
753757
);

0 commit comments

Comments
 (0)