* tree-cfg.c (replace_uses_by): Call mark_new_vars_to_rename.
(tree_merge_blocks): Propagate anything allowed by
may_propagate_copy.
Clarify documentation.
* passes.c (execute_todo): If cleanup_tree_cfg invalidated the
SSA form, schedule an update if necessary.
testsuite/ChangeLog
PR 22037
* g++.dg/tree-ssa/pr22037.C:
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102740
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-08-04 Diego Novillo <dnovillo@redhat.com>
+
+ PR 22037
+ * tree-cfg.c (replace_uses_by): Call mark_new_vars_to_rename.
+ (tree_merge_blocks): Propagate anything allowed by
+ may_propagate_copy.
+ Clarify documentation.
+ * passes.c (execute_todo): If cleanup_tree_cfg invalidated the
+ SSA form, schedule an update if necessary.
+
2005-08-04 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (Binaries): Remove broken link to
cleanup_tree_cfg_loop ();
else
cleanup_tree_cfg ();
+
+ /* When cleanup_tree_cfg merges consecutive blocks, it may
+ perform some simplistic propagation when removing single
+ valued PHI nodes. This propagation may, in turn, cause the
+ SSA form to become out-of-date (see PR 22037). So, even
+ if the parent pass had not scheduled an SSA update, we may
+ still need to do one. */
+ if (!(flags & TODO_update_ssa_any) && need_ssa_update_p ())
+ flags |= TODO_update_ssa;
}
if (flags & TODO_update_ssa_any)
+2005-08-04 Diego Novillo <dnovillo@redhat.com>
+
+ PR 22037
+ * g++.dg/tree-ssa/pr22037.C:
+
2005-08-04 Richard Henderson <rth@redhat.com>
* gcc.dg/tree-ssa/update-cunroll.c: Fix mistakes in
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern double sqrt (double) throw ();
+
+void foo(double& d, int n)
+{
+ double e=0;
+ for(int i=0; i<n; i++);
+ for(int i=0; i<n; i++) e=1;
+ d = sqrt(e);
+
+ for(int i=0; i<n; i++);
+}
if (TREE_CODE (rhs) == ADDR_EXPR)
recompute_tree_invarant_for_addr_expr (rhs);
- update_stmt (stmt);
+ mark_new_vars_to_rename (stmt);
}
VEC_free (tree, heap, stmts);
if (dump_file)
fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
- /* Remove the phi nodes. */
+ /* Remove all single-valued PHI nodes from block B of the form
+ V_i = PHI <V_j> by propagating V_j to all the uses of V_i. */
bsi = bsi_last (a);
for (phi = phi_nodes (b); phi; phi = phi_nodes (b))
{
tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
tree copy;
- if (!may_propagate_copy (def, use)
- /* Propagating pointers might cause the set of vops for statements
- to be changed, and thus require ssa form update. */
- || (is_gimple_reg (def)
- && POINTER_TYPE_P (TREE_TYPE (def))))
+ if (!may_propagate_copy (def, use))
{
gcc_assert (is_gimple_reg (def));
}
else
replace_uses_by (def, use);
+
remove_phi_node (phi, NULL);
}