+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.
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
--- /dev/null
+/* { 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" } } */
{
/* 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,
{
/* 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)
*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
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);
/* 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;