summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-tail-merge.c
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-18 08:57:39 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-18 08:57:39 +0000
commit4c3030b9f7724b3d623a0dae095116a524c5441f (patch)
tree3b1b6394f8dab21f1dae90612735039580316aaf /gcc/tree-ssa-tail-merge.c
parent56cf6489fd290abbf972d7a5b0f8fde79d4750de (diff)
downloadgcc-4c3030b9f7724b3d623a0dae095116a524c5441f.tar.gz
2011-10-18 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/50672 * tree-ssa-dce.c (mark_virtual_operand_for_renaming): New function, factored out of ... (mark_virtual_phi_result_for_renaming): Use mark_virtual_operand_for_renaming. * tree-flow.h (mark_virtual_operand_for_renaming): Declare. * tree-ssa-tail-merge.c (release_last_vdef): New function. (purge_bbs): Add update_vops parameter. Call release_last_vdef for each deleted basic block. (tail_merge_optimize): Add argument to call to purge_bbs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180126 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-tail-merge.c')
-rw-r--r--gcc/tree-ssa-tail-merge.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 611a30f23a4..529388c1b22 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -773,18 +773,56 @@ same_succ_flush_bbs (bitmap bbs)
}
}
+/* Release the last vdef in BB, either normal or phi result. */
+
+static void
+release_last_vdef (basic_block bb)
+{
+ gimple_stmt_iterator i;
+
+ for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (&i))
+ {
+ gimple stmt = gsi_stmt (i);
+ if (gimple_vdef (stmt) == NULL_TREE)
+ continue;
+
+ mark_virtual_operand_for_renaming (gimple_vdef (stmt));
+ return;
+ }
+
+ for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+ {
+ gimple phi = gsi_stmt (i);
+ tree res = gimple_phi_result (phi);
+
+ if (is_gimple_reg (res))
+ continue;
+
+ mark_virtual_phi_result_for_renaming (phi);
+ return;
+ }
+
+}
+
/* Delete all deleted_bbs. */
static void
-purge_bbs (void)
+purge_bbs (bool update_vops)
{
unsigned int i;
bitmap_iterator bi;
+ basic_block bb;
same_succ_flush_bbs (deleted_bbs);
EXECUTE_IF_SET_IN_BITMAP (deleted_bbs, 0, i, bi)
- delete_basic_block (BASIC_BLOCK (i));
+ {
+ bb = BASIC_BLOCK (i);
+ if (!update_vops)
+ release_last_vdef (bb);
+
+ delete_basic_block (bb);
+ }
bitmap_and_compl_into (deleted_bb_preds, deleted_bbs);
bitmap_clear (deleted_bbs);
@@ -1665,7 +1703,7 @@ tail_merge_optimize (unsigned int todo)
break;
free_dominance_info (CDI_DOMINATORS);
- purge_bbs ();
+ purge_bbs (update_vops);
if (iteration_nr == max_iterations)
break;