[PATCH] D15393: [X86] Order the local stack symbols to improve code size and locality.

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 13:42:22 PST 2015


hfinkel added a subscriber: hfinkel.

================
Comment at: lib/Target/X86/X86FrameLowering.cpp:2714
@@ +2713,3 @@
+  // info).
+  std::sort(SortingObjects.begin(), SortingObjects.end(),
+            X86FrameSortingAlgorithm());
----------------
Based on your comparison function, it looks like this should be stable_sort.

================
Comment at: lib/Target/X86/X86FrameLowering.h:240
@@ +239,3 @@
+        static_cast<double>(a.ObjectSize);
+      DensityB = static_cast<double>(b.ObjectNumUses) /
+        static_cast<double>(b.ObjectSize);
----------------
I'm somewhat afraid of using floating-point comparisons here because you might run into the same problems we had when computing block frequencies/probabilities with floating-point (that you'd get different answers on different systems because of enhanced intermediate precision and other non-strict-IEEE effects). Especially because we have a floating-point equality comparison below.


http://reviews.llvm.org/D15393





More information about the llvm-commits mailing list