diff options
author | Richard Biener <rguenther@suse.de> | 2014-06-17 07:37:24 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-06-17 07:37:24 +0000 |
commit | a4ab23b698ec5b8810a23df011453967d1d09180 (patch) | |
tree | 69c9a5b75cdba1ad54ff7ef330006bf5ec0f52db /gcc/tree-ssa-loop-im.c | |
parent | 31107d5d29e15ca7a385068b6fa09457f4cce6e1 (diff) | |
download | gcc-a4ab23b698ec5b8810a23df011453967d1d09180.zip gcc-a4ab23b698ec5b8810a23df011453967d1d09180.tar.gz gcc-a4ab23b698ec5b8810a23df011453967d1d09180.tar.bz2 |
tree-ssa-loop-im.c (determine_max_movement): Adjust cost of PHI node moving.
2014-06-17 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-im.c (determine_max_movement): Adjust cost
of PHI node moving.
* gcc.dg/tree-ssa/ssa-lim-12.c: New testcase.
From-SVN: r211724
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index e957f92..6569c06 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -729,14 +729,21 @@ determine_max_movement (gimple stmt, bool must_preserve_exec) } if (!add_dependency (val, lim_data, loop, false)) return false; - def_data = get_lim_data (SSA_NAME_DEF_STMT (val)); - if (def_data) + + gimple def_stmt = SSA_NAME_DEF_STMT (val); + if (gimple_bb (def_stmt) + && gimple_bb (def_stmt)->loop_father == loop) { - min_cost = MIN (min_cost, def_data->cost); - total_cost += def_data->cost; + def_data = get_lim_data (def_stmt); + if (def_data) + { + min_cost = MIN (min_cost, def_data->cost); + total_cost += def_data->cost; + } } } + min_cost = MIN (min_cost, total_cost); lim_data->cost += min_cost; if (gimple_phi_num_args (stmt) > 1) |