[PATCH] D24790: [LoopUnroll] Use the upper bound of the loop trip count to completely unroll loops

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 01:23:22 PDT 2016


ABataev added a subscriber: ABataev.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:5349
@@ +5348,3 @@
+unsigned ScalarEvolution::getSmallConstantMaxTripCount(Loop *L) {
+  const SCEVConstant *MaxExitCount =
+      dyn_cast<SCEVConstant>(getMaxBackedgeTakenCount(L));
----------------
const auto *MaxExitCount

================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:543
@@ +542,3 @@
+      // after any iteration.
+      NeedConditional = (UseUpperBound && j) ? true : false;
+    } else if (j != BreakoutTrip && (TripMultiple == 0 || j % TripMultiple != 0)) {
----------------
Maybe just `NeedConditional = (UseUpperBound && j)`?


Repository:
  rL LLVM

https://reviews.llvm.org/D24790





More information about the llvm-commits mailing list