[llvm] r276830 - Move assert as early as possible

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 20:30:11 PDT 2016


Author: spop
Date: Tue Jul 26 22:30:11 2016
New Revision: 276830

URL: http://llvm.org/viewvc/llvm-project?rev=276830&view=rev
Log:
Move assert as early as possible

Patch written by Aditya Kumar.

Differential Revision: https://reviews.llvm.org/D22816

Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h

Modified: llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h?rev=276830&r1=276829&r2=276830&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfoImpl.h Tue Jul 26 22:30:11 2016
@@ -252,6 +252,8 @@ void LoopBase<BlockT, LoopT>::verifyLoop
         HasInsideLoopSuccs = true;
         break;
       }
+    assert(HasInsideLoopSuccs && "Loop block has no in-loop successors!");
+
     typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits;
     for (typename InvBlockTraits::ChildIteratorType PI =
            InvBlockTraits::child_begin(BB), PE = InvBlockTraits::child_end(BB);
@@ -262,6 +264,7 @@ void LoopBase<BlockT, LoopT>::verifyLoop
       else
         OutsideLoopPreds.push_back(N);
     }
+    assert(HasInsideLoopPreds && "Loop block has no in-loop predecessors!");
 
     if (BB == getHeader()) {
         assert(!OutsideLoopPreds.empty() && "Loop is unreachable!");
@@ -275,8 +278,6 @@ void LoopBase<BlockT, LoopT>::verifyLoop
           assert(CB != OutsideLoopPreds[i] &&
                  "Loop has multiple entry points!");
     }
-    assert(HasInsideLoopPreds && "Loop block has no in-loop predecessors!");
-    assert(HasInsideLoopSuccs && "Loop block has no in-loop successors!");
     assert(BB != &getHeader()->getParent()->front() &&
            "Loop contains function entry block!");
 




More information about the llvm-commits mailing list