[llvm] [AA] A conservative fix for atomic store instruction. (PR #155032)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 14:33:22 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Jin Huang (jinhuang1102)
<details>
<summary>Changes</summary>
The current atomic store check in function `AAResults::getModRefInfo` would compare to the `AtomicOrdering::Unordered` that mean any atomic store instruction will return `ModRefInfo::ModRef` without performing any further analysis on the memory location itself.
This PR raises the comparison form `Unordered` to `Monotonic`.
---
Full diff: https://github.com/llvm/llvm-project/pull/155032.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/AliasAnalysis.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 3ec009ca4adde..b18ef88509b5c 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -439,7 +439,7 @@ ModRefInfo AAResults::getModRefInfo(const StoreInst *S,
const MemoryLocation &Loc,
AAQueryInfo &AAQI) {
// Be conservative in the face of atomic.
- if (isStrongerThan(S->getOrdering(), AtomicOrdering::Unordered))
+ if (isStrongerThan(S->getOrdering(), AtomicOrdering::Monotonic))
return ModRefInfo::ModRef;
if (Loc.Ptr) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/155032
More information about the llvm-commits
mailing list