diff options
| author | bors <bors@rust-lang.org> | 2022-06-26 07:12:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-26 07:12:16 +0000 |
| commit | 0e1a6fb463e7075572cee841525bf44a864da807 (patch) | |
| tree | b515e950192f1afb4048d30cdee51fe9ca7d21a9 /compiler/rustc_codegen_llvm/src | |
| parent | 639a655e11306116e8507d401a1262e87e1b23b7 (diff) | |
| parent | fba8dfd75f9182a0793284c3d6766132c9965421 (diff) | |
| download | rust-0e1a6fb463e7075572cee841525bf44a864da807.tar.gz rust-0e1a6fb463e7075572cee841525bf44a864da807.zip | |
Auto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #98371 (Fix printing `impl trait` under binders) - #98385 (Work around llvm 12's memory ordering restrictions.) - #98474 (x.py: Support systems with only `python3` not `python`) - #98488 (Bump RLS to latest master on rust-lang/rls) - #98491 (Fix backtrace UI test when panic=abort is used) - #98502 (Fix source sidebar hover in ayu theme) - #98509 (diagnostics: consider parameter count when suggesting smart pointers) - #98513 (Fix LLVM rebuild with download-ci-llvm.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/builder.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index c41a41980eb..8c1e865762c 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -1064,11 +1064,25 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { dst: &'ll Value, cmp: &'ll Value, src: &'ll Value, - order: rustc_codegen_ssa::common::AtomicOrdering, + mut order: rustc_codegen_ssa::common::AtomicOrdering, failure_order: rustc_codegen_ssa::common::AtomicOrdering, weak: bool, ) -> &'ll Value { let weak = if weak { llvm::True } else { llvm::False }; + if llvm_util::get_version() < (13, 0, 0) { + use rustc_codegen_ssa::common::AtomicOrdering::*; + // Older llvm has the pre-C++17 restriction on + // success and failure memory ordering, + // requiring the former to be at least as strong as the latter. + // So, for llvm 12, we upgrade the success ordering to a stronger + // one if necessary. + match (order, failure_order) { + (Relaxed, Acquire) => order = Acquire, + (Release, Acquire) => order = AcquireRelease, + (_, SequentiallyConsistent) => order = SequentiallyConsistent, + _ => {} + } + } unsafe { llvm::LLVMRustBuildAtomicCmpXchg( self.llbuilder, |
