[llvm-branch-commits] [llvm] [AMDGPU] Make amdgpu.noclobber respect acquire operations (PR #219991)

Fabian Ritter via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 14 03:56:56 PDT 2026


================
@@ -393,15 +391,29 @@ bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA) {
     }
   }
 
-  // Ignore atomics not aliasing with the original load, any atomic is a
-  // universal MemoryDef from MSSA's point of view too, just like a fence.
-  const auto checkNoAlias = [AA, Ptr](auto I) -> bool {
-    return I && AA->isNoAlias(I->getPointerOperand(), Ptr);
+  // Ignore non-acquire atomics not aliasing with the original load, any atomic
+  // is a universal MemoryDef from MSSA's point of view too, just like a fence.
+  // Acquire (or stronger) fences/atomics act as clobbers because they can bring
+  // in effects from other threads.
+  const auto MayAlias = [AA, Ptr](auto I) -> bool {
+    return !AA->isNoAlias(I->getPointerOperand(), Ptr);
   };
 
-  if (checkNoAlias(dyn_cast<AtomicCmpXchgInst>(DefInst)) ||
-      checkNoAlias(dyn_cast<AtomicRMWInst>(DefInst)))
-    return false;
+  if (const auto *F = dyn_cast<FenceInst>(DefInst))
+    return isAcquireOrStronger(F->getOrdering());
----------------
ritter-x2a wrote:

I've added #231855 to the PR stack to do that (which required extracting some MMRA accessors and related functionality from SIMemoryLegalizer: #231854).

https://github.com/llvm/llvm-project/pull/219991


More information about the llvm-branch-commits mailing list