summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-02-13 17:32:26 +0000
committerDuncan Sands <baldrick@free.fr>2009-02-13 17:32:26 +0000
commit566ed102441dd35ca8c141665011cdba8d1f1b70 (patch)
tree5a221a4b03456cb32e9560914e62d685e91ee959
parent971f9b661901ab88b408ad4adf3098bf41941b75 (diff)
downloadbcm5719-llvm-566ed102441dd35ca8c141665011cdba8d1f1b70.tar.gz
bcm5719-llvm-566ed102441dd35ca8c141665011cdba8d1f1b70.zip
If a function only reads memory, then we know that...
it only reads memory! The other change has no functional effect, it just seems more logical to go in order of decreasing knowledge. llvm-svn: 64463
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 369f2f4f90e..67b2faac55d 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -120,9 +120,13 @@ AliasAnalysis::getModRefBehavior(CallSite CS,
AliasAnalysis::ModRefBehavior
AliasAnalysis::getModRefBehavior(Function *F,
std::vector<PointerAccessInfo> *Info) {
- if (F && F->doesNotAccessMemory())
- // Can't do better than this.
- return DoesNotAccessMemory;
+ if (F) {
+ if (F->doesNotAccessMemory())
+ // Can't do better than this.
+ return DoesNotAccessMemory;
+ else if (F->onlyReadsMemory())
+ return OnlyReadsMemory;
+ }
return UnknownModRefBehavior;
}
@@ -130,10 +134,10 @@ AliasAnalysis::ModRefResult
AliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
ModRefResult Mask = ModRef;
ModRefBehavior MRB = getModRefBehavior(CS);
- if (MRB == OnlyReadsMemory)
- Mask = Ref;
- else if (MRB == DoesNotAccessMemory)
+ if (MRB == DoesNotAccessMemory)
return NoModRef;
+ else if (MRB == OnlyReadsMemory)
+ Mask = Ref;
else if (MRB == AliasAnalysis::AccessesArguments) {
bool doesAlias = false;
for (CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end();
@@ -142,7 +146,7 @@ AliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
doesAlias = true;
break;
}
-
+
if (!doesAlias)
return NoModRef;
}
OpenPOWER on IntegriCloud