diff options
author | Chris Lattner <sabre@nondot.org> | 2005-03-26 22:47:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-03-26 22:47:03 +0000 |
commit | 9cc932d3b3c99f5c405170b96a340dfacb0bf6a2 (patch) | |
tree | d18441d53f01241a963acca5e3c6a36429bb2f34 /llvm/lib/Analysis/DataStructure/DataStructureAA.cpp | |
parent | b3baff18300d7fbbb7244147fad18b09c6ab7985 (diff) | |
download | bcm5719-llvm-9cc932d3b3c99f5c405170b96a340dfacb0bf6a2.tar.gz bcm5719-llvm-9cc932d3b3c99f5c405170b96a340dfacb0bf6a2.zip |
slightly improve mod/ref for DSAA by checking the globals graph for fallback
llvm-svn: 20868
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructureAA.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructureAA.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp b/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp index 6f1cb56d860..c2449c2b74a 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp @@ -222,6 +222,18 @@ DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) { cast<GlobalVariable>(P)->getType()->getElementType()->isFirstClassType() && "This isn't a global that DSA inconsiderately dropped " "from the graph?"); + + DSGraph &GG = *CallerTDGraph.getGlobalsGraph(); + DSScalarMap::iterator NI = GG.getScalarMap().find(P); + if (NI != GG.getScalarMap().end() && !NI->second.isNull()) { + // Otherwise, if the node is only M or R, return this. This can be + // useful for globals that should be marked const but are not. + DSNode *N = NI->second.getNode(); + if (!N->isModified()) + Result = (ModRefResult)(Result & ~Mod); + if (!N->isRead()) + Result = (ModRefResult)(Result & ~Ref); + } } return Result; } |