From: Justin Bogner Date: Wed, 4 Feb 2015 00:12:18 +0000 (+0000) Subject: InstrProf: Use a stable sort when reading coverage regions X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3d4b2188af8bbc0db7c4860e52363ec3fcd3fd70;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228083 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ProfileData/CoverageMappingWriter.cpp b/lib/ProfileData/CoverageMappingWriter.cpp index aef5511fc0e..d90d2f56515 100644 --- a/lib/ProfileData/CoverageMappingWriter.cpp +++ b/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);