tree-cfg.c (gimple_can_merge_blocks_p): Move label and loop latch tests earlier.
* tree-cfg.c (gimple_can_merge_blocks_p): Move label and loop latch tests earlier. From-SVN: r151604
This commit is contained in:
parent
07c358c60c
commit
8e7c5fddbe
@ -1,5 +1,8 @@
|
||||
2009-09-10 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* tree-cfg.c (gimple_can_merge_blocks_p): Move label and
|
||||
loop latch tests earlier.
|
||||
|
||||
* gimple-iterator.c (gimple_find_edge_insert_loc): Insert
|
||||
before GIMPLE_RETURN, not after its predecessor; insert
|
||||
before GIMPLE_RESX.
|
||||
|
@ -1354,6 +1354,24 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
|
||||
&& DECL_NONLOCAL (gimple_label_label (stmt)))
|
||||
return false;
|
||||
|
||||
/* Examine the labels at the beginning of B. */
|
||||
for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||
{
|
||||
tree lab;
|
||||
stmt = gsi_stmt (gsi);
|
||||
if (gimple_code (stmt) != GIMPLE_LABEL)
|
||||
break;
|
||||
lab = gimple_label_label (stmt);
|
||||
|
||||
/* Do not remove user labels. */
|
||||
if (!DECL_ARTIFICIAL (lab))
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Protect the loop latches. */
|
||||
if (current_loops && b->loop_father->latch == b)
|
||||
return false;
|
||||
|
||||
/* It must be possible to eliminate all phi nodes in B. If ssa form
|
||||
is not up-to-date, we cannot eliminate any phis; however, if only
|
||||
some symbols as whole are marked for renaming, this is not a problem,
|
||||
@ -1377,21 +1395,6 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
|
||||
}
|
||||
}
|
||||
|
||||
/* Do not remove user labels. */
|
||||
for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||
{
|
||||
stmt = gsi_stmt (gsi);
|
||||
if (gimple_code (stmt) != GIMPLE_LABEL)
|
||||
break;
|
||||
if (!DECL_ARTIFICIAL (gimple_label_label (stmt)))
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Protect the loop latches. */
|
||||
if (current_loops
|
||||
&& b->loop_father->latch == b)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user