Use stable_sort instead of plain sort to avoid the risk of generating
authorDan Gohman <gohman@apple.com>
Wed, 6 May 2009 22:54:33 +0000 (22:54 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 6 May 2009 22:54:33 +0000 (22:54 +0000)
trivially different code on different hosts (due to differing
std::sort implementations).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71124 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 1b3aae878958b622c7285a002c7e4f28f41a5556..50cece03657565300f48be20805d24ae4201462d 100644 (file)
@@ -472,7 +472,7 @@ static void GroupByComplexity(std::vector<SCEVHandle> &Ops) {
   }
 
   // Do the rough sort by complexity.
-  std::sort(Ops.begin(), Ops.end(), SCEVComplexityCompare());
+  std::stable_sort(Ops.begin(), Ops.end(), SCEVComplexityCompare());
 
   // Now that we are sorted by complexity, group elements of the same
   // complexity.  Note that this is, at worst, N^2, but the vector is likely to