From bc499de74fef014485e96ed3f34b9ddf6dfcb81c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 26 Mar 2005 22:47:03 +0000 Subject: [PATCH] slightly improve mod/ref for DSAA by checking the globals graph for fallback git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20868 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/DataStructureAA.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Analysis/DataStructure/DataStructureAA.cpp b/lib/Analysis/DataStructure/DataStructureAA.cpp index 6f1cb56d860..c2449c2b74a 100644 --- a/lib/Analysis/DataStructure/DataStructureAA.cpp +++ b/lib/Analysis/DataStructure/DataStructureAA.cpp @@ -222,6 +222,18 @@ DSAA::getModRefInfo(CallSite CS, Value *P, unsigned Size) { cast(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; } -- 2.34.1