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
This commit is contained in:
Justin Bogner 2015-02-04 00:12:18 +00:00
parent 60705f77f6
commit 3d4b2188af

View File

@ -109,7 +109,7 @@ static void writeCounter(ArrayRef<CounterExpression> 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);