summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-03 15:31:24 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-03 15:31:24 +0000
commitd0ac373660de64fe210e50458c7702432b3f9605 (patch)
tree4e4a4900da55efe996274d087096cb54c26b6f06 /lib
parent9a036b945c67aeb44093c6c515e4b85e21094335 (diff)
downloadllvm-d0ac373660de64fe210e50458c7702432b3f9605.tar.gz
llvm-d0ac373660de64fe210e50458c7702432b3f9605.tar.bz2
llvm-d0ac373660de64fe210e50458c7702432b3f9605.tar.xz
Since onlyReadsMemory returns true if in fact
doesNotAccessMemory, check doesNotAccessMemory first, since otherwise functions may be marked readonly rather than readnone. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index c8347c23fd..5f38469498 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -376,14 +376,16 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
if (F->isDeclaration()) {
// Try to get mod/ref behaviour from function attributes.
- if (F->onlyReadsMemory()) {
+ if (F->doesNotAccessMemory()) {
+ // Can't do better than that!
+ } else if (F->onlyReadsMemory()) {
FunctionEffect |= Ref;
// This function might call back into the module and read a global, so
// mark all globals read somewhere as being read by this function.
for (std::set<GlobalValue*>::iterator GI = ReadGlobals.begin(),
E = ReadGlobals.end(); GI != E; ++GI)
FR.GlobalInfo[*GI] |= Ref;
- } else if (!F->doesNotAccessMemory()) {
+ } else {
// Can't say anything useful.
KnowNothing = true;
}