From cf8462f3004d3fc72217d09e4b3f135d68a50e9d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 30 Jun 2008 21:04:06 +0000 Subject: [PATCH] Use reserve. SelectionDAG::allnodes_size is linear, but that doesn't appear to outweigh the benefit of reducing heap traffic. If it does become a problem, we should teach SelectionDAG to keep a count of how many nodes are live, because there are several other places where that information would be useful as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52926 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 38171dff752..581d6ee0426 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -592,6 +592,7 @@ void DAGCombiner::Run(bool RunningAfterLegalize) { AfterLegalize = RunningAfterLegalize; // Add all the dag nodes to the worklist. + WorkList.reserve(DAG.allnodes_size()); for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), E = DAG.allnodes_end(); I != E; ++I) WorkList.push_back(I);