1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 13:02:52 +02:00

Fix bug: 2003-02-27-PreheaderExitNodeUpdate.ll by updating exit node info

llvm-svn: 5664
This commit is contained in:
Chris Lattner 2003-02-27 22:48:57 +00:00
parent e6443c72fe
commit d64f135965

View File

@ -193,6 +193,22 @@ void Preheaders::InsertPreheaderForLoop(Loop *L) {
if (Loop *Parent = L->getParentLoop())
Parent->addBasicBlockToLoop(NewBB, getAnalysis<LoopInfo>());
// If the header for the loop used to be an exit node for another loop, then
// we need to update this to know that the loop-preheader is now the exit
// node. Note that the only loop that could have our header as an exit node
// is a sibling loop, ie, one with the same parent loop.
const std::vector<Loop*> *ParentSubLoops;
if (Loop *Parent = L->getParentLoop())
ParentSubLoops = &Parent->getSubLoops();
else // Must check top-level loops...
ParentSubLoops = &getAnalysis<LoopInfo>().getTopLevelLoops();
// Loop over all sibling loops, performing the substitution...
for (unsigned i = 0, e = ParentSubLoops->size(); i != e; ++i)
if ((*ParentSubLoops)[i]->hasExitBlock(Header))
(*ParentSubLoops)[i]->changeExitBlock(Header, NewBB);
DominatorSet &DS = getAnalysis<DominatorSet>(); // Update dominator info
{
// The blocks that dominate NewBB are the blocks that dominate Header,