From: Benjamin Kramer Date: Wed, 16 Sep 2009 11:43:12 +0000 (+0000) Subject: Don't sort the vector when it is empty. This should fix some expensive checking X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4f1b266fd83c819ea2cf7cbd9bcd377d95c4eb6;p=oota-llvm.git Don't sort the vector when it is empty. This should fix some expensive checking failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82040 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MachineModuleInfoImpls.cpp b/lib/CodeGen/MachineModuleInfoImpls.cpp index 10de1deec4e..7a6292910f4 100644 --- a/lib/CodeGen/MachineModuleInfoImpls.cpp +++ b/lib/CodeGen/MachineModuleInfoImpls.cpp @@ -38,7 +38,8 @@ MachineModuleInfoMachO::SymbolListTy MachineModuleInfoMachO::GetSortedStubs(const DenseMap &Map) { MachineModuleInfoMachO::SymbolListTy List(Map.begin(), Map.end()); - qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair); + if (!List.empty()) + qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair); return List; }