[llvm] [NVPTX] Add syncscope support for cmpxchg (PR #140812)
Princeton Ferro via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 09:04:59 PDT 2025
================
@@ -6272,10 +6272,12 @@ 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,
+ SSID);
----------------
Prince781 wrote:
nit: I think this looks cleaner, but it's up to you:
```suggestion
return Builder.CreateFence(Ord == AtomicOrdering::SequentiallyConsistent
? Ord
: AtomicOrdering::Release,
SSID);
```
https://github.com/llvm/llvm-project/pull/140812
More information about the llvm-commits
mailing list