[llvm-branch-commits] [llvm] [AMDGPU] Make amdgpu.noclobber respect acquire operations (PR #219991)
Krzysztof Drewniak via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 18 13:57:36 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());
----------------
krzysz00 wrote:
I think this is the spot where we check for MMRAs on the fence to make sure we aren't pessimizing based on LDS-only fences
https://github.com/llvm/llvm-project/pull/219991
More information about the llvm-branch-commits
mailing list