Graphs that are part of equivalence sets can be multi-function SCC's
themselves. Make sure to update DSInfo correctly. This fixes a testcase
reduced from Prolangs-C++/objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17439 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
index 6a2c298..40c6a21 100644
--- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp
+++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
@@ -214,16 +214,21 @@
DSGraph &CBUGraph = CBU->getDSGraph(*F);
if (!GraphsMerged.insert(&CBUGraph).second)
continue;
- assert(FG == 0 && "Remerged a graph?");
// Record the "folded" graph for the function.
- FG = &MergedG;
+ for (DSGraph::ReturnNodesTy::iterator
+ I = CBUGraph.getReturnNodes().begin(),
+ E = CBUGraph.getReturnNodes().end();
+ I != E; ++I) {
+ assert(DSInfo[I->first] == 0 && "Graph already exists for Fn!");
+ DSInfo[I->first] = &MergedG;
+ }
// Clone this member of the equivalence class into MergedG.
DSGraph::NodeMapTy NodeMap;
MergedG.cloneInto(CBUGraph, MergedG.getScalarMap(),
- MergedG.getReturnNodes(), NodeMap, 0);
+ MergedG.getReturnNodes(), NodeMap, 0);
// Merge the return nodes of all functions together.
MergedG.getReturnNodes()[LF].mergeWith(MergedG.getReturnNodes()[F]);