[llvm-commits] [llvm] r95879 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Feb 11 10:06:56 PST 2010
Author: stoklund
Date: Thu Feb 11 12:06:56 2010
New Revision: 95879
URL: http://llvm.org/viewvc/llvm-project?rev=95879&view=rev
Log:
Use array_pod_sort instead of std::sort for improved code size.
Use SmallVector instead of std::vector for better speed when indirectbr has
few successors.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95879&r1=95878&r2=95879&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 11 12:06:56 2010
@@ -2063,11 +2063,11 @@
void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) {
// Update machine-CFG edges with unique successors.
- std::vector<BasicBlock*> succs;
+ SmallVector<BasicBlock*, 32> succs;
succs.reserve(I.getNumSuccessors());
for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i)
succs.push_back(I.getSuccessor(i));
- std::sort(succs.begin(), succs.end());
+ array_pod_sort(succs.begin(), succs.end());
succs.erase(std::unique(succs.begin(), succs.end()), succs.end());
for (unsigned i = 0, e = succs.size(); i != e; ++i)
CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]);
More information about the llvm-commits
mailing list