forked from OSchip/llvm-project
[LoopUnroll] Use addClonedBlockToLoopInfo to add loop header to LI (NFC).
Summary: I have a similar patch up for review already (D29173). If you prefer I can squash them both together. Also I think there more potential for code sharing between LoopUnroll.cpp and LoopUnrollRuntime.cpp. Do you think patches for that would be worthwhile? Reviewers: mkuper, mzolotukhin Reviewed By: mkuper, mzolotukhin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29311 llvm-svn: 293758
This commit is contained in:
parent
3a52eb0054
commit
a35b8a4852
|
@ -472,19 +472,16 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, bool Force,
|
|||
BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It));
|
||||
Header->getParent()->getBasicBlockList().push_back(New);
|
||||
|
||||
assert(*BB != Header || LI->getLoopFor(*BB) == L &&
|
||||
"Header should not be in a sub-loop");
|
||||
// Tell LI about New.
|
||||
if (*BB == Header) {
|
||||
assert(LI->getLoopFor(*BB) == L && "Header should not be in a sub-loop");
|
||||
L->addBasicBlockToLoop(New, *LI);
|
||||
} else {
|
||||
const Loop *OldLoop = addClonedBlockToLoopInfo(*BB, New, LI, NewLoops);
|
||||
if (OldLoop) {
|
||||
LoopsToSimplify.insert(NewLoops[OldLoop]);
|
||||
const Loop *OldLoop = addClonedBlockToLoopInfo(*BB, New, LI, NewLoops);
|
||||
if (OldLoop) {
|
||||
LoopsToSimplify.insert(NewLoops[OldLoop]);
|
||||
|
||||
// Forget the old loop, since its inputs may have changed.
|
||||
if (SE)
|
||||
SE->forgetLoop(OldLoop);
|
||||
}
|
||||
// Forget the old loop, since its inputs may have changed.
|
||||
if (SE)
|
||||
SE->forgetLoop(OldLoop);
|
||||
}
|
||||
|
||||
if (*BB == Header)
|
||||
|
|
Loading…
Reference in New Issue