[PATCH] D148071: [LoopUnroll] Prevent LoopFullUnrollPass to perform partial/runtime unrolling

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 00:58:52 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp:1127
                 ProfileSummaryInfo *PSI, bool PreserveLCSSA, int OptLevel,
-                bool OnlyWhenForced, bool ForgetAllSCEV,
+                bool isFullUnroll, bool OnlyWhenForced, bool ForgetAllSCEV,
                 std::optional<unsigned> ProvidedCount,
----------------
isFullUnroll -> OnlyFullUnroll?


================
Comment at: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp:1309
+  // Do not attempt partial/runtime unrolling in FullLoopUnrolling
+  if (isFullUnroll && !TripCount) {
+    LLVM_DEBUG(
----------------
This probably isn't quite the right condition. I can think of two problematic cases here:

 * We know the trip count, but it's very large, so we will only perform a partial unroll. We don't want to do that during FullUnroll.
 * We know the max trip count and unroll to the max trip count, removing the loop. I think we consider this a full unroll as well.

I believe our criterion for what counts as a full unroll is basically "is the unroll count >= max trip count".


================
Comment at: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp:1311
+    LLVM_DEBUG(
+        dbgs() << "Not attempting parital/runtime unroll in FullLoopUnroll"
+               << "\n");
----------------
parital -> partial


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148071/new/

https://reviews.llvm.org/D148071



More information about the llvm-commits mailing list