1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Make the spliceFrom case where one graph is completely empty be constant time.

llvm-svn: 20825
This commit is contained in:
Chris Lattner 2005-03-25 00:02:41 +00:00
parent a90eb0ff31
commit 02206c42f2

View File

@ -1321,8 +1321,12 @@ void DSGraph::spliceFrom(DSGraph &RHS) {
AuxFunctionCalls.splice(AuxFunctionCalls.end(), RHS.AuxFunctionCalls);
// Take all of the return nodes.
ReturnNodes.insert(RHS.ReturnNodes.begin(), RHS.ReturnNodes.end());
RHS.ReturnNodes.clear();
if (ReturnNodes.empty()) {
ReturnNodes.swap(RHS.ReturnNodes);
} else {
ReturnNodes.insert(RHS.ReturnNodes.begin(), RHS.ReturnNodes.end());
RHS.ReturnNodes.clear();
}
// Merge the scalar map in.
ScalarMap.spliceFrom(RHS.ScalarMap);