Skip to content

Commit 745f68c

Browse files
committed
[LoopDeletion] Add an assert that verifies LCSSA
This is inspired by PR24804 -- had this assert been there before, isolating the root cause for PR24804 would have been far easier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261481 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 31fee5e commit 745f68c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Transforms/Scalar/LoopDeletion.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ bool LoopDeletion::runOnLoop(Loop *L, LPPassManager &) {
122122
if (skipOptnoneFunction(L))
123123
return false;
124124

125+
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
126+
assert(L->isLCSSAForm(DT) && "Expected LCSSA!");
127+
125128
// We can only remove the loop if there is a preheader that we can
126129
// branch from after removing it.
127130
BasicBlock *preheader = L->getLoopPreheader();
@@ -194,7 +197,6 @@ bool LoopDeletion::runOnLoop(Loop *L, LPPassManager &) {
194197

195198
// Update the dominator tree and remove the instructions and blocks that will
196199
// be deleted from the reference counting scheme.
197-
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
198200
SmallVector<DomTreeNode*, 8> ChildNodes;
199201
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
200202
LI != LE; ++LI) {

0 commit comments

Comments
 (0)