[PATCH] D63921: [Loop Peeling] Add support for peeling of loops with multiple exits

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 11:21:24 PDT 2019


fhahn added inline comments.


================
Comment at: include/llvm/Analysis/LoopInfo.h:282
+  template <class ParamBlockT>
+  void getExitEdges(SmallVectorImpl<std::pair<ParamBlockT *, ParamBlockT *> > &
+                        ExitEdges) const {
----------------
This is not directly related to the peeling changes. I think it would be better to split this off in a separate patch & also add a test to the loopInfo unit tests with differing const-ness.


================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:407
+        if (!L->contains(Succ)) {
+          ExitingBlock = Succ;
+          break;
----------------
Unless I am missing something, it looks like `Succ` here is outside the loop, which would mean that the latch would be an *exiting* block and Succ an *exit* block?


================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:412
       Preheader = L->getLoopPreheader();
       ULO.TripCount = SE->getSmallConstantTripCount(L, ExitingBlock);
       ULO.TripMultiple = SE->getSmallConstantTripMultiple(L, ExitingBlock);
----------------
IIRC TripCount and TripMultiple would not be set for multi-exit loops (in LoopUnrollPass.cpp), but MaxTripCount would. But maybe I am missing the reasoning behind choosing the trip count of one of the exits?


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

https://reviews.llvm.org/D63921





More information about the llvm-commits mailing list