Index: llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -512,6 +512,13 @@
 
   BasicBlock *Latch = L->getLoopLatch();
 
+  // 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!");
   // Loop structure is the following:
   //
   // PreHeader