[llvm-commits] [llvm] r64463 - /llvm/trunk/lib/Analysis/AliasAnalysis.cpp
Duncan Sands
baldrick at free.fr
Fri Feb 13 09:32:26 PST 2009
Author: baldrick
Date: Fri Feb 13 11:32:26 2009
New Revision: 64463
URL: http://llvm.org/viewvc/llvm-project?rev=64463&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=64463&r1=64462&r2=64463&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Fri Feb 13 11:32:26 2009
@@ -120,9 +120,13 @@
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::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 @@
doesAlias = true;
break;
}
-
+
if (!doesAlias)
return NoModRef;
}
More information about the llvm-commits
mailing list