[llvm] r264381 - Bitcode: Use std::stable_partition for reproducible builds

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 19:20:28 PDT 2016

Author: dexonsmith
Date: Thu Mar 24 21:20:28 2016
New Revision: 264381

URL: http://llvm.org/viewvc/llvm-project?rev=264381&view=rev
Bitcode: Use std::stable_partition for reproducible builds

Caught by inspection while working on partitioning metadata.  It's nice
to produce the same bitcode if you run the compiler twice.


Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=264381&r1=264380&r2=264381&view=diff
--- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp Thu Mar 24 21:20:28 2016
@@ -472,8 +472,8 @@ void ValueEnumerator::OptimizeConstants(
   // Ensure that integer and vector of integer constants are at the start of the
   // constant pool.  This is important so that GEP structure indices come before
   // gep constant exprs.
-  std::partition(Values.begin()+CstStart, Values.begin()+CstEnd,
-                 isIntOrIntVectorValue);
+  std::stable_partition(Values.begin() + CstStart, Values.begin() + CstEnd,
+                        isIntOrIntVectorValue);
   // Rebuild the modified portion of ValueMap.
   for (; CstStart != CstEnd; ++CstStart)

More information about the llvm-commits mailing list