On Thu, Feb 07, 2013 at 02:56:48PM +0100, Richard Biener wrote: > > + /* Check the headers. */ > > + FOR_EACH_BB (bb) > > + { > > + /* Skip BBs in the root tree. */ > > + if (bb->loop_father == current_loops->tree_root) > > + continue; > > You shouldn't need this ... it will miss missing toplevel loops
Done. > > + if (bb_loop_header_p (bb)) > > + if (bb->loop_father->header != bb) > > && bb->loop_father->header != bb) Fixed. Regtested/bootstrapped on x86_64 again (with tailc fix: http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00310.html), ok now? 2013-02-07 Marek Polacek <pola...@redhat.com> * cfgloop.c (verify_loop_structure): Add more checking of headers. --- gcc/cfgloop.c.mp 2013-02-07 14:07:24.580864372 +0100 +++ gcc/cfgloop.c 2013-02-07 15:06:19.278571095 +0100 @@ -1353,6 +1353,15 @@ verify_loop_structure (void) } } + /* Check the headers. */ + FOR_EACH_BB (bb) + if (bb_loop_header_p (bb) + && bb->loop_father->header != bb) + { + error ("loop with header %d not in loop tree", bb->index); + err = 1; + } + /* Check get_loop_body. */ visited = sbitmap_alloc (last_basic_block); bitmap_clear (visited); Marek