diff options
author | Duncan Sands <baldrick@free.fr> | 2008-09-03 15:31:24 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-09-03 15:31:24 +0000 |
commit | 0eca0571f86ae7cea43a08985d7dcaa27effdbb2 (patch) | |
tree | 212aba4fb17a3a577dafc79dcc5cfeec14433c6a /llvm/lib | |
parent | 42c644ef0317a0c2cfdde9d9186977b859a2b7b1 (diff) | |
download | bcm5719-llvm-0eca0571f86ae7cea43a08985d7dcaa27effdbb2.tar.gz bcm5719-llvm-0eca0571f86ae7cea43a08985d7dcaa27effdbb2.zip |
Since onlyReadsMemory returns true if in fact
doesNotAccessMemory, check doesNotAccessMemory
first, since otherwise functions may be
marked readonly rather than readnone.
llvm-svn: 55697
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/IPA/GlobalsModRef.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/IPA/GlobalsModRef.cpp b/llvm/lib/Analysis/IPA/GlobalsModRef.cpp index c8347c23fdb..5f384694984 100644 --- a/llvm/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/llvm/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; } |