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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20825 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-03-25 00:02:41 +00:00
parent 5734e4331e
commit ce7068d378

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);