aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-30 22:16:42 +0000
committerChris Lattner <sabre@nondot.org>2004-01-30 22:16:42 +0000
commitf4d904d7e326c9cbed497ca681b6270170fd2020 (patch)
tree9565e65866dfaa6647fa76621d0458227bc37661 /lib/Analysis/AliasAnalysis.cpp
parent762e8e846f0ad50ffea56216c5ea20db1c95b756 (diff)
Improve mod/ref information based on the pointsToConstantMemory method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--lib/Analysis/AliasAnalysis.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp
index c881ec283a..373524b6c1 100644
--- a/lib/Analysis/AliasAnalysis.cpp
+++ b/lib/Analysis/AliasAnalysis.cpp
@@ -44,8 +44,15 @@ AliasAnalysis::getModRefInfo(LoadInst *L, Value *P, unsigned Size) {
AliasAnalysis::ModRefResult
AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) {
- return alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()),
- P, Size) ? Mod : NoModRef;
+ // If the stored address cannot alias the pointer in question, then the
+ // pointer cannot be modified by the store.
+ if (!alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()),
+ P, Size))
+ return NoModRef;
+
+ // If the pointer is a pointer to constant memory, then it could not have been
+ // modified by this store.
+ return pointsToConstantMemory(P) ? NoModRef : Mod;
}