[PATCH] D28179: Make sure total loop body weight is preserved in loop peeling

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 01:09:55 PST 2017


davidxl added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:338
   uint64_t TrueWeight, FalseWeight;
-  uint64_t ExitWeight = 0, BackEdgeWeight = 0;
+  uint64_t ExitWeight = 0, LoopBodyWeight = 0;
   if (LatchBR->extractProfMetadata(TrueWeight, FalseWeight)) {
----------------
Might be better to name it 

CurHeaderWeight or just HeaderWeight


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:351
 
     // The exit weight of the previous iteration is the header entry weight
     // of the current iteration. So this is exactly how many dynamic iterations
----------------
This comment is not accurate. Better 

"Subtract the exit weight from the current header weight -- the exit weight is exactly ..."


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:393
   if (ExitWeight) {
+    // The backedge count is the difference of remaining loop body weight and
+    // loop body entry count. If the remaining loop body weight is smaller than
----------------
remaining loop body weight --> current header weight

loop body entry count --> current loop exit weight


https://reviews.llvm.org/D28179





More information about the llvm-commits mailing list