From: Zdenek Dvorak Date: Fri, 31 May 2002 11:09:17 +0000 (+0200) Subject: cfgloop.c (flow_loops_find): Initialize first and last fields correctly. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a72fb761ecbcb9ec734eea3ce550caa08a3d014;p=gcc.git cfgloop.c (flow_loops_find): Initialize first and last fields correctly. * cfgloop.c (flow_loops_find): Initialize first and last fields correctly. From-SVN: r54104 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 151362c85e0..b2027582869 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-05-31 Zdenek Dvorak + + * cfgloop.c (flow_loops_find): Initialize first and last fields + correctly. + 2002-05-31 Neil Booth * c-common.c (builtin_define_std): Correct logic. diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index aed264172fd..7b0c8415d88 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -644,7 +644,7 @@ flow_loops_find (loops, flags) sbitmap *dom; int *dfs_order; int *rc_order; - basic_block header; + basic_block header, bb; /* This function cannot be repeatedly called with different flags to build up the loop information. The loop tree @@ -768,10 +768,16 @@ flow_loops_find (loops, flags) These are often the same as the loop header and loop latch respectively, but this is not always the case. */ - loop->first - = BASIC_BLOCK (sbitmap_first_set_bit (loop->nodes)); - loop->last - = BASIC_BLOCK (sbitmap_last_set_bit (loop->nodes)); + + FOR_EACH_BB (bb) + if (TEST_BIT (loop->nodes, bb->index)) + break; + loop->first = bb; + + FOR_EACH_BB_REVERSE (bb) + if (TEST_BIT (loop->nodes, bb->index)) + break; + loop->last = bb; flow_loop_scan (loops, loop, flags); }