Commit b09d108b by Josef Zlomek Committed by Richard Henderson

cfgloop.c (flow_loops_find): Use the information of the depth first search order…

cfgloop.c (flow_loops_find): Use the information of the depth first search order of the CFG correctly when...

        * cfgloop.c (flow_loops_find): Use the information of the depth
        first search order of the CFG correctly when finding natural loops.

From-SVN: r48227
parent f350566b
2001-12-20 Josef Zlomek <zlomek@matfyz.cz>
* cfgloop.c (flow_loops_find): Use the information of the depth
first search order of the CFG correctly when finding natural loops.
2001-12-20 Richard Henderson <rth@redhat.com> 2001-12-20 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.md (prologue_mcount): Update for explicit relocs. * config/alpha/alpha.md (prologue_mcount): Update for explicit relocs.
......
...@@ -737,26 +737,26 @@ flow_loops_find (loops, flags) ...@@ -737,26 +737,26 @@ flow_loops_find (loops, flags)
/* Find and record information about all the natural loops /* Find and record information about all the natural loops
in the CFG. */ in the CFG. */
num_loops = 0; num_loops = 0;
for (b = 0; b < n_basic_blocks; b++) for (b = n_basic_blocks - 1; b >= 0; b--)
{ {
basic_block header; basic_block latch;
/* Search the nodes of the CFG in reverse completion order /* Search the nodes of the CFG in reverse completion order
so that we can find outer loops first. */ so that we can find outer loops first. */
header = BASIC_BLOCK (rc_order[b]); latch = BASIC_BLOCK (rc_order[b]);
/* Look for all the possible latch blocks for this header. */ /* Look for all the possible headers for this latch block. */
for (e = header->pred; e; e = e->pred_next) for (e = latch->succ; e; e = e->succ_next)
{ {
basic_block latch = e->src; basic_block header = e->dest;
/* Look for back edges where a predecessor is dominated /* Look for forward edges where this block is dominated by
by this block. A natural loop has a single entry a successor of this block. A natural loop has a single
node (header) that dominates all the nodes in the entry node (header) that dominates all the nodes in the
loop. It also has single back edge to the header loop. It also has single back edge to the header from a
from a latch node. Note that multiple natural loops latch node. Note that multiple natural loops may share
may share the same header. */ the same header. */
if (latch != ENTRY_BLOCK_PTR if (header != EXIT_BLOCK_PTR
&& TEST_BIT (dom[latch->index], header->index)) && TEST_BIT (dom[latch->index], header->index))
{ {
struct loop *loop; struct loop *loop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment