DSGraph &getOrCreateGraph(Function &F);
- DSGraph* cloneGraph(Function &F);
-
bool hasFoldedGraph(const Function& F) const {
hash_map<const Function*, DSGraph*>::const_iterator I =
FoldedGraphsMap.find(const_cast<Function*>(&F));
// This equiv class has multiple functions: merge their graphs. First,
// clone the CBU graph for the leader and make it the common graph for the
// equivalence graph.
- DSGraph* mergedG = cloneGraph(*LF);
+ DSGraph *mergedG = &getOrCreateGraph(*LF);
// Record the argument nodes for use in merging later below
EquivClassGraphArgsInfo& GraphInfo = getECGraphInfo(mergedG);
DSGraph *&Graph = FoldedGraphsMap[&F];
if (Graph) return *Graph;
- return *cloneGraph(F);
-}
-
-DSGraph *PA::EquivClassGraphs::cloneGraph(Function &F) {
- DSGraph *&Graph = FoldedGraphsMap[&F];
DSGraph &CBUGraph = CBU->getDSGraph(F);
- assert(Graph == 0 && "Cloning a graph twice?");
// Copy the CBU graph...
Graph = new DSGraph(CBUGraph); // updates the map via reference
FG = Graph;
}
- return Graph;
+ return *Graph;
}