From c6407fab16d7df27e24a26864e15874e9eb43f3f Mon Sep 17 00:00:00 2001 From: rth Date: Thu, 10 Sep 2009 18:27:59 +0000 Subject: [PATCH] * tree-cfg.c (gimple_can_merge_blocks_p): Move label and loop latch tests earlier. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151604 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 3 +++ gcc/tree-cfg.c | 33 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b91445..c110d53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2009-09-10 Richard Henderson + * 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. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 1357064..b834943 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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; } -- 2.7.4