[PATCH] D33001: [RuntimeUnrolling] Add logic for loops with multiple exit blocks

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 14:09:25 PDT 2017


anna added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:495
   // to be guaranteed by the callers of UnrollRuntimeLoopRemainder.
-  BranchInst *LatchBR = cast<BranchInst>(Latch->getTerminator());
-  assert((LatchBR->getSuccessor(0) == LatchExit ||
-          LatchBR->getSuccessor(1) == LatchExit) &&
-         "one of the loop latch successors should be "
-         "the exit block!");
-  (void)LatchBR;
+  assert(!L->contains(LatchBR->getSuccessor(ExitIndex)) &&
+         "one of the loop latch successors should be the exit block!");
----------------
Note: This assert is actually NFC wrt old assert, but it increases the compile time because `contains` is O(number of blocks in loop). That's the reason I didn't check it in separately. 

We cannot directly compare against `LatchExit` as done previously, since it may not exist. 


https://reviews.llvm.org/D33001





More information about the llvm-commits mailing list