mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
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
This commit is contained in:
parent
9a036b945c
commit
d0ac373660
@ -376,14 +376,16 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
|
|||||||
|
|
||||||
if (F->isDeclaration()) {
|
if (F->isDeclaration()) {
|
||||||
// Try to get mod/ref behaviour from function attributes.
|
// 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;
|
FunctionEffect |= Ref;
|
||||||
// This function might call back into the module and read a global, so
|
// This function might call back into the module and read a global, so
|
||||||
// mark all globals read somewhere as being read by this function.
|
// mark all globals read somewhere as being read by this function.
|
||||||
for (std::set<GlobalValue*>::iterator GI = ReadGlobals.begin(),
|
for (std::set<GlobalValue*>::iterator GI = ReadGlobals.begin(),
|
||||||
E = ReadGlobals.end(); GI != E; ++GI)
|
E = ReadGlobals.end(); GI != E; ++GI)
|
||||||
FR.GlobalInfo[*GI] |= Ref;
|
FR.GlobalInfo[*GI] |= Ref;
|
||||||
} else if (!F->doesNotAccessMemory()) {
|
} else {
|
||||||
// Can't say anything useful.
|
// Can't say anything useful.
|
||||||
KnowNothing = true;
|
KnowNothing = true;
|
||||||
}
|
}
|
||||||
|
9
test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
Normal file
9
test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readnone | count 2
|
||||||
|
|
||||||
|
define i32 @f() {
|
||||||
|
entry:
|
||||||
|
%tmp = call i32 @e( ) ; <i32> [#uses=1]
|
||||||
|
ret i32 %tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @e() readnone
|
Loading…
Reference in New Issue
Block a user