[llvm-commits] [llvm] r168074 - /llvm/trunk/lib/CodeGen/StackColoring.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Nov 15 15:54:00 PST 2012


On Nov 15, 2012, at 11:33 AM, Ulrich Weigand <Ulrich.Weigand at de.ibm.com> wrote:
>   // Sort the slots according to their size. Place unused slots at the end.
> -  std::sort(SortedSlots.begin(), SortedSlots.end(), SlotSizeSorter(MFI));
> +  // Use stable sort to guarantee deterministic code generation.
> +  std::stable_sort(SortedSlots.begin(), SortedSlots.end(),
> +                   SlotSizeSorter(MFI));

Hi Ulrich,

Both stable_sort() and sort() expand into more than 100K of code which is why LLVM provides array_pod_sort() as a wrapper for the libc qsort() function.

In this case, it is very easy to provide a total ordering so you don't need a stable sort.

/jakob




More information about the llvm-commits mailing list