[llvm] [AA] Improve precision for monotonic atomic load/store operations (PR #158169)

Jin Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 09:16:04 PDT 2025


================
@@ -457,8 +465,15 @@ ModRefInfo AAResults::getModRefInfo(const StoreInst *S,
       return ModRefInfo::NoModRef;
   }
 
+  // At this point, the store's ordering is at most `Monotonic` (i.e.,
+  // Monotonic, Unordered, or non-atomic), and it aliases with `Loc`. The
+  // condition `isStrongerThan(S->getOrdering(), AtomicOrdering::Unordered)` is
+  // true only for `Monotonic` stores.
+  if (isStrongerThan(S->getOrdering(), AtomicOrdering::Unordered))
+    return ModRefInfo::ModRef;
----------------
jinhuang1102 wrote:

After the `if (Loc.Ptr)` condition, the store instruction isn't the alias with `Loc`. I think if this if statement is added, wouldn't it be consistent with the final return of the function?

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


More information about the llvm-commits mailing list