re PR tree-optimization/43934 (LIM should handle PHI nodes)

PR tree-optimization/43934
* tree-ssa-loop-im.c (determine_max_movement): Add PHI def constant cost.

From-SVN: r211302
This commit is contained in:
Christian Bruel 2014-06-06 09:21:02 +02:00 committed by Christian Bruel
parent 4a450ea0d1
commit d969f3c163
4 changed files with 37 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-06-06 Christian Bruel <christian.bruel@st.com>
PR tree-optimization/43934
* tree-ssa-loop-im.c (determine_max_movement): Add PHI def constant cost.
2014-06-06 Richard Sandiford <rdsandiford@googlemail.com>
* ira-lives.c (single_reg_class): Add missing break. Explicitly

View File

@ -1,3 +1,8 @@
2014-06-06 Christian Bruel <christian.bruel@st.com>
PR tree-optimization/43934
* gcc.dg/tree-ssa/ssa-lim-8.c: New testcase.
2014-06-05 S. Gilles <sgilles@terpmail.umd.edu>
PR c/53119

View File

@ -0,0 +1,20 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-lim1-details" } */
void bar (int);
void foo (int n, int m)
{
unsigned i;
for (i = 0; i < n; ++i)
{
int x;
if (m < 0)
x = 1;
else
x = m;
bar (x);
}
}
/* { dg-final { scan-tree-dump-times "Moving PHI node" 1 "lim1" } } */
/* { dg-final { cleanup-tree-dump "lim1" } } */

View File

@ -719,8 +719,14 @@ determine_max_movement (gimple stmt, bool must_preserve_exec)
FOR_EACH_PHI_ARG (use_p, stmt, iter, SSA_OP_USE)
{
val = USE_FROM_PTR (use_p);
if (TREE_CODE (val) != SSA_NAME)
continue;
{
/* Assign const 1 to constants. */
min_cost = MIN (min_cost, 1);
total_cost += 1;
continue;
}
if (!add_dependency (val, lim_data, loop, false))
return false;
def_data = get_lim_data (SSA_NAME_DEF_STMT (val));