[llvm-commits] CVS: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Nov 2 11:30:13 PST 2004
Changes in directory poolalloc/lib/PoolAllocate:
EquivClassGraphs.cpp updated: 1.15 -> 1.16
---
Log message:
Correctly handle new SCC's found as a result of merging EQ graphs do to
function pointer equivalences. This fixes many problems, including a testcase
reduced Prolangs-C++/objects.
---
Diffs of the changes: (+18 -5)
Index: poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp
diff -u poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.15 poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.16
--- poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp:1.15 Tue Nov 2 11:51:11 2004
+++ poolalloc/lib/PoolAllocate/EquivClassGraphs.cpp Tue Nov 2 13:29:59 2004
@@ -306,19 +306,32 @@
return Min; // This is part of a larger SCC!
// If this is a new SCC, process it now.
- bool IsMultiNodeSCC = false;
+ bool MergedGraphs = false;
while (Stack.back() != &FG) {
DSGraph *NG = Stack.back();
ValMap[NG] = ~0U;
- // Since all SCCs must be the same as those found in CBU, we do not need to
- // do any merging. Make sure all functions in the SCC share the same graph.
- assert(NG == &FG && "ECG discovered different SCC's than the CBU pass?");
+ // If the SCC found is not the same as those found in CBU, make sure to
+ // merge the graphs as appropriate.
+ DSGraph::NodeMapTy NodeMap;
+ FG.cloneInto(*NG, FG.getScalarMap(), FG.getReturnNodes(), NodeMap);
+
+ // Update the DSInfo map and delete the old graph...
+ for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
+ I != NG->getReturnNodes().end(); ++I)
+ DSInfo[I->first] = &FG;
+ // Remove NG from the ValMap since the pointer may get recycled.
+ ValMap.erase(NG);
+ delete NG;
+ MergedGraphs = true;
Stack.pop_back();
- IsMultiNodeSCC = true;
}
+ // Clean up the graph before we start inlining a bunch again.
+ if (MergedGraphs)
+ FG.removeTriviallyDeadNodes();
+
Stack.pop_back();
processGraph(FG);
More information about the llvm-commits
mailing list