forked from OSchip/llvm-project
[loop-unroll] Properly populate LoopInfo for loops cloned in LoopUnrollRuntime.
Summary: This fixes Transforms/LoopUnroll/runtime-loop3.ll which failed with EXTENSIVE_DEBUG, because the cloned basic blocks were not added to the correct sub-loops in LoopUnrollRuntime.cpp. Reviewers: dexonsmith, mzolotukhin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28482 llvm-svn: 291619
This commit is contained in:
parent
7d81813d76
commit
4f9d6d56c0
|
@ -301,15 +301,17 @@ static void CloneLoopBlocks(Loop *L, Value *NewIter,
|
||||||
LI->addTopLevelLoop(NewLoop);
|
LI->addTopLevelLoop(NewLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NewLoopsMap NewLoops;
|
||||||
|
NewLoops[L] = NewLoop;
|
||||||
// For each block in the original loop, create a new copy,
|
// For each block in the original loop, create a new copy,
|
||||||
// and update the value map with the newly created values.
|
// and update the value map with the newly created values.
|
||||||
for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) {
|
for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) {
|
||||||
BasicBlock *NewBB = CloneBasicBlock(*BB, VMap, "." + suffix, F);
|
BasicBlock *NewBB = CloneBasicBlock(*BB, VMap, "." + suffix, F);
|
||||||
NewBlocks.push_back(NewBB);
|
NewBlocks.push_back(NewBB);
|
||||||
|
|
||||||
if (NewLoop)
|
if (NewLoop) {
|
||||||
NewLoop->addBasicBlockToLoop(NewBB, *LI);
|
addClonedBlockToLoopInfo(*BB, NewBB, LI, NewLoops);
|
||||||
else if (ParentLoop)
|
} else if (ParentLoop)
|
||||||
ParentLoop->addBasicBlockToLoop(NewBB, *LI);
|
ParentLoop->addBasicBlockToLoop(NewBB, *LI);
|
||||||
|
|
||||||
VMap[*BB] = NewBB;
|
VMap[*BB] = NewBB;
|
||||||
|
|
Loading…
Reference in New Issue