Lines Matching refs:Latch
102 // Simplify the loop latch before attempting to rotate the header
241 BasicBlock *Latch = L->getLoopLatch();
242 if (!Latch || Latch->hasAddressTaken())
245 BranchInst *Jmp = dyn_cast<BranchInst>(Latch->getTerminator());
249 BasicBlock *LastExit = Latch->getSinglePredecessor();
257 if (!shouldSpeculateInstrs(Latch->begin(), Jmp))
260 DEBUG(dbgs() << "Folding loop latch " << Latch->getName() << " into "
263 // Hoist the instructions from Latch into LastExit.
264 LastExit->getInstList().splice(BI, Latch->getInstList(), Latch->begin(), Jmp);
266 unsigned FallThruPath = BI->getSuccessor(0) == Latch ? 0 : 1;
270 // Remove Latch from the CFG so that LastExit becomes the new Latch.
272 Latch->replaceSuccessorsPhiUsesWith(LastExit);
275 // Nuke the Latch block.
276 assert(Latch->empty() && "unable to evacuate Latch");
277 LI->removeBlock(Latch);
280 DTWP->getDomTree().eraseNode(Latch);
281 Latch->eraseFromParent();
287 /// \param SimplifiedLatch is true if the latch was just folded into the final
288 /// loop exit. In this case we may want to rotate even though the new latch is
289 /// now an exiting branch. This rotation would have happened had the latch not
291 /// rotating loops in which the latch exits to avoid excessive or endless
293 /// form. This property is satisfied because simplifying the loop latch can only
313 // If the loop latch already contains a branch that leaves the loop then the
318 // Rotate if either the loop latch does *not* exit the loop, or if the loop
319 // latch was just simplified.
443 assert(L->getHeader() == NewHeader && "Latch block is our new header");
467 // loop latch.
506 "Despite splitting all preds, failed to split latch exit?");
555 assert(L->getLoopLatch() && "Invalid loop latch after loop rotation");