[PATCH] D25963: [LoopUnroll] Implement profile-based loop peeling

David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 13:31:24 PDT 2016


davidxl added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:111
+// PreHeader and Exit are the preheader and exit block of the original loop.
+// RemainingHeaderWeight is the number of *dynamic* loop entries still
+// unaccounted for - that is, it is the number of times we expect to enter
----------------
I think this parameter should better be called 'PeeledHeaderWeight' -- it is really the weight of the 'header' block of the current peeled iteration.  The PeeledHeaderWeight will be updated to the next iteration's header weight after this call is done.

The name 'Remaining' sounds like the original value of this weight parameter is the sum of all peeled iteration's header weight, but it is actually not.


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:295
+    // the current peeled-off static iteration uses up.
+    BackEdgeWeight -= ExitWeight;
+
----------------
If user request a large peel count, this may end up < 0 which should be avoided. Make it as least >=0.


https://reviews.llvm.org/D25963





More information about the llvm-commits mailing list