[llvm] [NVPTX] Add syncscope support for cmpxchg (PR #140812)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 01:56:58 PDT 2025
================
@@ -6317,10 +6317,13 @@ Instruction *NVPTXTargetLowering::emitLeadingFence(IRBuilderBase &Builder,
// Specialize for cmpxchg
// Emit a fence.sc leading fence for cmpxchg seq_cst which are not emulated
+ SyncScope::ID SSID = cast<AtomicCmpXchgInst>(Inst)->getSyncScopeID();
if (isReleaseOrStronger(Ord))
- return Ord == AtomicOrdering::SequentiallyConsistent
- ? Builder.CreateFence(AtomicOrdering::SequentiallyConsistent)
- : Builder.CreateFence(AtomicOrdering::Release);
+ return Builder.CreateFence(
+ Ord == AtomicOrdering::SequentiallyConsistent
+ ? AtomicOrdering::SequentiallyConsistent
+ : AtomicOrdering::Release,
----------------
gonzalobg wrote:
```suggestion
return Builder.CreateFence(
Ord == AtomicOrdering::SequentiallyConsistent
? AtomicOrdering::SequentiallyConsistent
: AtomicOrdering::Release, // applies if Release or AcqRel
```
https://github.com/llvm/llvm-project/pull/140812
More information about the llvm-commits
mailing list