[PATCH] D32801: [RuntimeLoopUnroller] Add assert that we dont unroll non-rotated loops

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 10:49:52 PDT 2017


anna marked an inline comment as done.
anna added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:515-521
+  // Cloning the loop basic blocks (`CloneLoopBlocks`) requires that one of the
+  // targets of the Latch be the single exit block out of the loop. This needs
+  // to be guaranteed by the callers of UnrollRuntimeLoopRemainder.
+  BranchInst *LatchBR = cast<BranchInst>(Latch->getTerminator());
+  assert(LatchBR->getSuccessor(0) == Exit ||
+         LatchBR->getSuccessor(1) == Exit && "loop latch successor should be "
+                                             "exit block!");
----------------
davide wrote:
> This seems like a natural extension of what I did.
> I think the fact that the other successor is the header is given by the definition of a latch, so we should be fine with this.
Thanks, yes. I had spotted this implicit dependency (latch's successor is an exit) in the runtime unroller's clone function and was wondering if we can have such a situation where the dependency is not true. Sanjoy had pointed me to your fix (and test case) in the loop unroller.


https://reviews.llvm.org/D32801





More information about the llvm-commits mailing list