[llvm] r261481 - [LoopDeletion] Add an assert that verifies LCSSA

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 21 09:11:59 PST 2016


Author: sanjoy
Date: Sun Feb 21 11:11:59 2016
New Revision: 261481

URL: http://llvm.org/viewvc/llvm-project?rev=261481&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=261481&r1=261480&r2=261481&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Sun Feb 21 11:11:59 2016
@@ -122,6 +122,9 @@ bool LoopDeletion::runOnLoop(Loop *L, LP
   if (skipOptnoneFunction(L))
     return false;
 
+  DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+  assert(L->isLCSSAForm(DT) && "Expected LCSSA!");
+
   // We can only remove the loop if there is a preheader that we can
   // branch from after removing it.
   BasicBlock *preheader = L->getLoopPreheader();
@@ -194,7 +197,6 @@ bool LoopDeletion::runOnLoop(Loop *L, LP
 
   // Update the dominator tree and remove the instructions and blocks that will
   // be deleted from the reference counting scheme.
-  DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
   SmallVector<DomTreeNode*, 8> ChildNodes;
   for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
        LI != LE; ++LI) {




More information about the llvm-commits mailing list