[PATCH] D18670: LoopUnroll: some small fixes/tweaks to make it more useful for partial unrolling

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 18:05:12 PDT 2016


mzolotukhin added a comment.

Hi,

In general the idea looks good to me, one remark is inline.

Michael

PS: Please upload the patch with full-context.


================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:639-644
@@ -638,5 +638,8 @@
       // Reduce unroll count to be modulo of TripCount for partial unrolling.
-      Count = (std::max(UP.PartialThreshold, 3u) - 2) / (LoopSize - 2);
+      if (UnrolledSize > UP.PartialThreshold)
+        Count = (std::max(UP.PartialThreshold, 3u) - 2) / (LoopSize - 2);
+      if (Count > UP.MaxCount)
+        Count = UP.MaxCount;
       while (Count != 0 && TripCount % Count != 0)
         Count--;
     }
----------------
I think we shouldn't do this if `CountSetExplicitly` is true.


Repository:
  rL LLVM

http://reviews.llvm.org/D18670





More information about the llvm-commits mailing list