diff options
author | Eric Christopher <echristo@apple.com> | 2011-11-15 23:37:17 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-11-15 23:37:17 +0000 |
commit | 0abbd0ef5a9ed5216646fd7e4912cb2ec35ee0c7 (patch) | |
tree | 5593fc3e80e9b32ac4ae38323b28ee8d1e400c13 | |
parent | 291ce47db730d2896da17232ece46371de4b9317 (diff) | |
download | bcm5719-llvm-0abbd0ef5a9ed5216646fd7e4912cb2ec35ee0c7.tar.gz bcm5719-llvm-0abbd0ef5a9ed5216646fd7e4912cb2ec35ee0c7.zip |
Stabilize the output of the dwarf accelerator tables. Fixes a comparison
failure during bootstrap with it turned on.
llvm-svn: 144731
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp index a3a24887615..6c77a631a92 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp @@ -60,7 +60,7 @@ void DwarfAccelTable::ComputeBucketCount(void) { uniques.resize(Data.size()); for (size_t i = 0, e = Data.size(); i < e; ++i) uniques[i] = Data[i]->HashValue; - std::sort(uniques.begin(), uniques.end()); + std::stable_sort(uniques.begin(), uniques.end()); std::vector<uint32_t>::iterator p = std::unique(uniques.begin(), uniques.end()); uint32_t num = std::distance(uniques.begin(), p); @@ -73,6 +73,15 @@ void DwarfAccelTable::ComputeBucketCount(void) { Header.hashes_count = num; } +namespace { + // DIESorter - comparison predicate that sorts DIEs by their offset. + struct DIESorter { + bool operator()(DIE *A, DIE *B) const { + return A->getOffset() < B->getOffset(); + } + }; +} + void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, const char *Prefix) { // Create the individual hash data outputs. for (StringMap<DIEArray>::iterator @@ -80,7 +89,7 @@ void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, const char *Prefix) { struct HashData *Entry = new HashData((*EI).getKeyData()); // Unique the entries. - std::sort((*EI).second.begin(), (*EI).second.end()); + std::stable_sort((*EI).second.begin(), (*EI).second.end(), DIESorter()); (*EI).second.erase(std::unique((*EI).second.begin(), (*EI).second.end()), (*EI).second.end()); |