[PATCH] D22816: Move assert as early as possible.

Aditya Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 09:13:04 PDT 2016


hiraditya created this revision.
hiraditya added reviewers: hfinkel, sanjoy.
hiraditya added subscribers: eli.friedman, sebpop, llvm-commits.
Herald added a subscriber: mzolotukhin.

https://reviews.llvm.org/D22816

Files:
  llvm/include/llvm/Analysis/LoopInfoImpl.h

Index: llvm/include/llvm/Analysis/LoopInfoImpl.h
===================================================================
--- llvm/include/llvm/Analysis/LoopInfoImpl.h
+++ llvm/include/llvm/Analysis/LoopInfoImpl.h
@@ -252,6 +252,8 @@
         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 @@
       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 @@
           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!");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22816.65539.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160726/2b30c2de/attachment.bin>


More information about the llvm-commits mailing list