[clang] [llvm] [IR] Instruction::maySynchronize should be false for monotonic atomics. (PR #230299)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 9 07:48:49 PDT 2026
================
@@ -1261,12 +1258,16 @@ bool Instruction::maySynchronize() const {
return FI->getSyncScopeID() != SyncScope::SingleThread;
}
case Instruction::AtomicRMW:
- case Instruction::AtomicCmpXchg:
- return true;
+ return isStrongerThanMonotonic(cast<AtomicRMWInst>(this)->getOrdering());
+ case Instruction::AtomicCmpXchg: {
+ auto *ACXI = cast<AtomicCmpXchgInst>(this);
+ return isStrongerThanMonotonic(ACXI->getSuccessOrdering()) ||
+ isStrongerThanMonotonic(ACXI->getFailureOrdering());
----------------
nikic wrote:
Could check getMergedOrdering instead.
https://github.com/llvm/llvm-project/pull/230299
More information about the cfe-commits
mailing list