[LCSSA] Assert that we always have a valid loop.

We could otherwise add BBs not belonging to a loop in `formLCSSA`
and later crash when trying to iterate the loop blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Davide Italiano 2017-04-13 20:05:37 +00:00
parent 24b800cc1d
commit c099906b13

View File

@ -87,6 +87,7 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
Instruction *I = Worklist.pop_back_val();
BasicBlock *InstBB = I->getParent();
Loop *L = LI.getLoopFor(InstBB);
assert(L && "Instruction belongs to a BB that's not part of a loop");
if (!LoopExitBlocks.count(L))
L->getExitBlocks(LoopExitBlocks[L]);
assert(LoopExitBlocks.count(L));