From 45396438c32840c33859a814436b6c7f4d3542b9 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 11 Feb 2010 18:06:56 +0000 Subject: [PATCH] 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. llvm-svn: 95879 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 477c1c701988..6f60c7b624e4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2063,11 +2063,11 @@ void SelectionDAGBuilder::visitSwitch(SwitchInst &SI) { void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) { // Update machine-CFG edges with unique successors. - std::vector succs; + SmallVector 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]]);