tree-scalar-evolution.c (follow_ssa_edge_in_rhs, [...]): Keep more precise track of the size of the expression.

* tree-scalar-evolution.c (follow_ssa_edge_in_rhs,
	follow_ssa_edge_in_condition_phi, follow_ssa_edge): Keep more precise
	track of the size of the expression.
	* cfghooks.c (merge_blocks): Remove block from loops structure only
	after call of the merge_blocks hook.

	* gcc.dg/tree-ssa/loop-28.c: New testcase.

From-SVN: r125595
This commit is contained in:
Zdenek Dvorak 2007-06-09 23:34:08 +02:00 committed by Zdenek Dvorak
parent 408a86c03e
commit 9e824336e5
5 changed files with 57 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-06-09 Zdenek Dvorak <dvorakz@suse.cz>
* tree-scalar-evolution.c (follow_ssa_edge_in_rhs,
follow_ssa_edge_in_condition_phi, follow_ssa_edge): Keep more precise
track of the size of the expression.
* cfghooks.c (merge_blocks): Remove block from loops structure only
after call of the merge_blocks hook.
2007-06-09 Tom Tromey <tromey@redhat.com>
* c-decl.c (grokdeclarator): Added 'deprecated_state' argument.

View File

@ -646,11 +646,11 @@ merge_blocks (basic_block a, basic_block b)
if (!cfg_hooks->merge_blocks)
internal_error ("%s does not support merge_blocks", cfg_hooks->name);
cfg_hooks->merge_blocks (a, b);
if (current_loops != NULL)
remove_bb_from_loops (b);
cfg_hooks->merge_blocks (a, b);
/* Normally there should only be one successor of A and that is B, but
partway though the merge of blocks for conditional_execution we'll
be merging a TEST block with THEN and ELSE successors. Free the

View File

@ -1,3 +1,7 @@
2007-06-09 Zdenek Dvorak <dvorakz@suse.cz>
* gcc.dg/tree-ssa/loop-28.c: New testcase.
2007-06-09 Ian Lance Taylor <iant@google.com>
PR tree-optimization/32169

View File

@ -0,0 +1,24 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -fdump-tree-final_cleanup -fdump-tree-aprefetch --param max-unrolled-insns=1000" } */
char x[100000];
void foo(int n)
{
int i;
for (i = 0; i < n; i++)
x[i] = (char) i;
}
/* There should be 64 MEMs in the unrolled loop and one more in the copy of the loop
for the rest of the iterations. */
/* { dg-final { scan-tree-dump-times "MEM" 65 "final_cleanup" } } */
/* There should be no i_a = i_b assignments. */
/* { dg-final { scan-tree-dump-times "i_.*= i_\[0-9\]*;" 0 "aprefetch" } } */
/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
/* { dg-final { cleanup-tree-dump "aprefetch" } } */

View File

@ -1056,6 +1056,12 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
{
/* Match an assignment under the form:
"a = b + c". */
/* We want only assignments of form "name + name" contribute to
LIMIT, as the other cases do not necessarily contribute to
the complexity of the expression. */
limit++;
evol = *evolution_of_loop;
res = follow_ssa_edge
(loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
@ -1141,6 +1147,13 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs,
{
/* Match an assignment under the form:
"a = b - ...". */
/* We want only assignments of form "name - name" contribute to
LIMIT, as the other cases do not necessarily contribute to
the complexity of the expression. */
if (TREE_CODE (rhs1) == SSA_NAME)
limit++;
res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
evolution_of_loop, limit);
if (res == t_true)
@ -1255,6 +1268,10 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
*evolution_of_loop = evolution_of_branch;
/* If the phi node is just a copy, do not increase the limit. */
if (PHI_NUM_ARGS (condition_phi) > 1)
limit++;
for (i = 1; i < PHI_NUM_ARGS (condition_phi); i++)
{
/* Quickly give up when the evolution of one of the branches is
@ -1338,7 +1355,7 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
return t_false;
/* Give up if the path is longer than the MAX that we allow. */
if (limit++ > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
if (limit > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
return t_dont_know;
def_loop = loop_containing_stmt (def);
@ -1369,7 +1386,7 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi,
/* Inner loop. */
if (flow_loop_nested_p (loop, def_loop))
return follow_ssa_edge_inner_loop_phi
(loop, def, halting_phi, evolution_of_loop, limit);
(loop, def, halting_phi, evolution_of_loop, limit + 1);
/* Outer loop. */
return t_false;