Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
Show First 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | static void UpdateAnalysisInformation(BasicBlock *OldBB, BasicBlock *NewBB, | ||||
Loop *L = LI->getLoopFor(OldBB); | Loop *L = LI->getLoopFor(OldBB); | ||||
// If we need to preserve loop analyses, collect some information about how | // If we need to preserve loop analyses, collect some information about how | ||||
// this split will affect loops. | // this split will affect loops. | ||||
bool IsLoopEntry = !!L; | bool IsLoopEntry = !!L; | ||||
bool SplitMakesNewLoopHeader = false; | bool SplitMakesNewLoopHeader = false; | ||||
for (BasicBlock *Pred : Preds) { | for (BasicBlock *Pred : Preds) { | ||||
// Preds that are not reachable from entry should not be used to identify if | |||||
// OldBB is a loop entry or if SplitMakesNewLoopHeader. Unreachable blocks | |||||
// are not within any loops, so we incorrectly mark SplitMakesNewLoopHeader | |||||
// as true and make the NewBB the header of some loop. This breaks LI. | |||||
if (!DT->isReachableFromEntry(Pred)) | |||||
continue; | |||||
// If we need to preserve LCSSA, determine if any of the preds is a loop | // If we need to preserve LCSSA, determine if any of the preds is a loop | ||||
// exit. | // exit. | ||||
if (PreserveLCSSA) | if (PreserveLCSSA) | ||||
if (Loop *PL = LI->getLoopFor(Pred)) | if (Loop *PL = LI->getLoopFor(Pred)) | ||||
if (!PL->contains(OldBB)) | if (!PL->contains(OldBB)) | ||||
HasLoopExit = true; | HasLoopExit = true; | ||||
// If we need to preserve LoopInfo, note whether any of the preds crosses | // If we need to preserve LoopInfo, note whether any of the preds crosses | ||||
▲ Show 20 Lines • Show All 464 Lines • Show Last 20 Lines |