aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-11-27 17:41:13 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-11-27 17:41:13 +0000
commit61ff02982f8e9be0df1ba9f658e1dad4f98839a7 (patch)
tree9e97581806724acfa113f89210534e2b2fe77398 /lib
parente127a14991b5eefd021dd785697afb7f3f09e955 (diff)
downloadexternal_llvm-61ff02982f8e9be0df1ba9f658e1dad4f98839a7.zip
external_llvm-61ff02982f8e9be0df1ba9f658e1dad4f98839a7.tar.gz
external_llvm-61ff02982f8e9be0df1ba9f658e1dad4f98839a7.tar.bz2
Fix logical error in TD pass: we should clear Mod/Ref bits of each caller
before inlining their graphs into a function. To support this, added flags to CloneFlags to strip/keep Mod/Ref bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp11
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp9
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp5
3 files changed, 17 insertions, 8 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index d8ae1de..c7fb42d 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -344,8 +344,9 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
#endif
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
- DSGraph::DontCloneCallNodes);
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits |
+ DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes);
#if 0
Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
@@ -424,7 +425,8 @@ DSGraph &BUDataStructures::inlineNonSCCGraphs(Function &F,
<< GI.getAuxFunctionCalls().size() << "]\n");
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
DSGraph::DontCloneCallNodes);
}
}
@@ -508,7 +510,8 @@ DSGraph &BUDataStructures::calculateSCCGraph(Function &F,
<< GI.getAuxFunctionCalls().size() << "]\n");
// Handle self recursion by resolving the arguments and return value
- Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+ Graph.mergeInGraph(CS, GI,
+ DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
DSGraph::DontCloneCallNodes);
if (SCCFunctions.count(Callee))
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index fe72bfe..d26213f 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -598,9 +598,14 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G,
Nodes[i]->remapLinks(OldNodeMap);
// Remove alloca markers as specified
- if (CloneFlags & StripAllocaBit)
+ if (CloneFlags & (StripAllocaBit | StripModRefBits)) {
+ unsigned short clearBits = (CloneFlags & StripAllocaBit
+ ? DSNode::AllocaNode : 0)
+ | (CloneFlags & StripModRefBits
+ ? (DSNode::Modified | DSNode::Read) : 0);
for (unsigned i = FN, e = Nodes.size(); i != e; ++i)
- Nodes[i]->NodeType &= ~DSNode::AllocaNode;
+ Nodes[i]->NodeType &= ~clearBits;
+ }
// Copy the value map... and merge all of the global nodes...
for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index aa9a6a9..da9bc7c 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -100,7 +100,7 @@ void TDDataStructures::calculateGraph(Function &F) {
const std::vector<DSCallSite> &CallSites = Graph.getFunctionCalls();
if (CallSites.empty()) {
DEBUG(std::cerr << " [TD] No callees for: " << F.getName() << "\n");
- return; // If no call sites, the graph is the same as the BU graph!
+ return; // If no call sites, there is nothing more to do here
}
// Loop over all of the call sites, building a multi-map from Callees to
@@ -143,9 +143,10 @@ void TDDataStructures::calculateGraph(Function &F) {
std::map<Value*, DSNodeHandle> OldValMap;
std::map<const DSNode*, DSNodeHandle> OldNodeMap;
CG.cloneInto(Graph, OldValMap, OldNodeMap,
+ DSGraph::StripModRefBits |
DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes);
OldValMap.clear(); // We don't care about the ValMap
-
+
// Loop over all of the invocation sites of the callee, resolving
// arguments to our graph. This loop may iterate multiple times if the
// current function calls this callee multiple times with different