From 70e0c09e6c0d19d8eba4740d20bf58ae9274bc47 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 4 Feb 2015 00:12:18 +0000 Subject: [PATCH] InstrProf: Use a stable sort when reading coverage regions Keeping regions that start at the same location in insertion order makes this logic easier to test / more deterministic. llvm-svn: 228083 --- llvm/lib/ProfileData/CoverageMappingWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/ProfileData/CoverageMappingWriter.cpp b/llvm/lib/ProfileData/CoverageMappingWriter.cpp index aef5511..d90d2f5 100644 --- a/llvm/lib/ProfileData/CoverageMappingWriter.cpp +++ b/llvm/lib/ProfileData/CoverageMappingWriter.cpp @@ -109,7 +109,7 @@ static void writeCounter(ArrayRef Expressions, Counter C, void CoverageMappingWriter::write(raw_ostream &OS) { // Sort the regions in an ascending order by the file id and the starting // location. - std::sort(MappingRegions.begin(), MappingRegions.end()); + std::stable_sort(MappingRegions.begin(), MappingRegions.end()); // Write out the fileid -> filename mapping. encodeULEB128(VirtualFileMapping.size(), OS); -- 2.7.4