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
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 @@
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 @@
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