[PATCH] D13764: [LoopUnswitch] Spill unswitch quota based on branch weight

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 17:09:15 PDT 2015


davidxl added inline comments.

================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:378
@@ +377,3 @@
+
+  // Spill quota based on branch weight. Notice that integer
+  // division will round to floor. Therefore to make sure the
----------------
spill --> split?

================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:384
@@ +383,3 @@
+  // behavior without branch weight).
+  NewLoopProps.CanBeUnswitchedCount =
+      Quota * NewLoopWeight / (NewLoopWeight + OldLoopWeight) +
----------------
TotalWeight = OldLoopWeight + NewLoopWeight;

... = (Quota * NewLoopWeight + TotalWeight/2)/TotalWeight;

for the right rounding.

================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:571
@@ +570,3 @@
+
+        // Get branch weights from metadata. Use default if metadata
+        // is not available.
----------------
Why not using BPI interfaces?


http://reviews.llvm.org/D13764





More information about the llvm-commits mailing list