diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-09 06:07:05 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-09 06:07:05 +0000 |
commit | 68b3554f5464d49465bfb68ddffb69668d9080d2 (patch) | |
tree | 21cc8202dd4afe5295fcd6fb1a2982baee7e6bc5 /gcc/tree-ssa-loop-ivopts.c | |
parent | 9afdea3935f7445cd9cc14d8a16e67ce271c275b (diff) | |
download | gcc-68b3554f5464d49465bfb68ddffb69668d9080d2.tar.gz |
2009-09-09 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 151544
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@151549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 67 |
1 files changed, 12 insertions, 55 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 05988636489..42b2ef36252 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -5297,42 +5297,6 @@ create_new_ivs (struct ivopts_data *data, struct iv_ca *set) } } -/* Returns the phi-node in BB with result RESULT. */ - -static gimple -get_phi_with_result (basic_block bb, tree result) -{ - gimple_stmt_iterator i = gsi_start_phis (bb); - - for (; !gsi_end_p (i); gsi_next (&i)) - if (gimple_phi_result (gsi_stmt (i)) == result) - return gsi_stmt (i); - - gcc_unreachable (); - return NULL; -} - - -/* Removes statement STMT (real or a phi node). If INCLUDING_DEFINED_NAME - is true, remove also the ssa name defined by the statement. */ - -static void -remove_statement (gimple stmt, bool including_defined_name) -{ - if (gimple_code (stmt) == GIMPLE_PHI) - { - gimple bb_phi = get_phi_with_result (gimple_bb (stmt), - gimple_phi_result (stmt)); - gimple_stmt_iterator bsi = gsi_for_stmt (bb_phi); - remove_phi_node (&bsi, including_defined_name); - } - else - { - gimple_stmt_iterator bsi = gsi_for_stmt (stmt); - gsi_remove (&bsi, true); - release_defs (stmt); - } -} /* Rewrites USE (definition of iv used in a nonlinear expression) using candidate CAND. */ @@ -5435,7 +5399,9 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data, { ass = gimple_build_assign (tgt, op); gsi_insert_before (&bsi, ass, GSI_SAME_STMT); - remove_statement (use->stmt, false); + + bsi = gsi_for_stmt (use->stmt); + remove_phi_node (&bsi, false); } else { @@ -5611,7 +5577,11 @@ remove_unused_ivs (struct ivopts_data *data) { unsigned j; bitmap_iterator bi; + bitmap toremove = BITMAP_ALLOC (NULL); + /* Figure out an order in which to release SSA DEFs so that we don't + release something that we'd have to propagate into a debug stmt + afterwards. */ EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j, bi) { struct version_info *info; @@ -5622,25 +5592,12 @@ remove_unused_ivs (struct ivopts_data *data) && !info->inv_id && !info->iv->have_use_for && !info->preserve_biv) - { - if (MAY_HAVE_DEBUG_STMTS) - { - gimple stmt; - imm_use_iterator iter; - - FOR_EACH_IMM_USE_STMT (stmt, iter, info->iv->ssa_name) - { - if (!gimple_debug_bind_p (stmt)) - continue; - - /* ??? We can probably do better than this. */ - gimple_debug_bind_reset_value (stmt); - update_stmt (stmt); - } - } - remove_statement (SSA_NAME_DEF_STMT (info->iv->ssa_name), true); - } + bitmap_set_bit (toremove, SSA_NAME_VERSION (info->iv->ssa_name)); } + + release_defs_bitset (toremove); + + BITMAP_FREE (toremove); } /* Frees data allocated by the optimization of a single loop. */ |