[DebugInfo] Stable sort symbols to remove non-deterministic ordering
authorMandeep Singh Grang <mgrang@codeaurora.org>
Sun, 25 Feb 2018 19:52:34 +0000 (19:52 +0000)
committerMandeep Singh Grang <mgrang@codeaurora.org>
Sun, 25 Feb 2018 19:52:34 +0000 (19:52 +0000)
Summary: This fixes failure in DebugInfo/X86/multiple-aranges.ll uncovered by D39245.

Reviewers: rafael, echristo, probinson

Reviewed By: probinson

Subscribers: probinson, llvm-commits, JDevlieghere

Tags: #debug-info

Differential Revision: https://reviews.llvm.org/D39950

llvm-svn: 326056

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 6b50fb9..7985908 100644 (file)
@@ -1780,7 +1780,7 @@ void DwarfDebug::emitDebugARanges() {
     }
 
     // Sort the symbols by offset within the section.
-    std::sort(
+    std::stable_sort(
         List.begin(), List.end(), [&](const SymbolCU &A, const SymbolCU &B) {
           unsigned IA = A.Sym ? Asm->OutStreamer->GetSymbolOrder(A.Sym) : 0;
           unsigned IB = B.Sym ? Asm->OutStreamer->GetSymbolOrder(B.Sym) : 0;