This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][mem-ref2] Fix forwprop
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Jun 2010 15:42:29 +0200 (CEST)
- Subject: [PATCH][mem-ref2] Fix forwprop
This fixes forwprop to properly build the temporary MEM_REF for
address arithmetic propagation.
Committed as obvious.
Richard.
2010-06-11 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
Fold the temporary MEM_REF we build.
Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc/tree-ssa-forwprop.c (revision 160604)
--- gcc/tree-ssa-forwprop.c (working copy)
*************** tree_ssa_forward_propagate_single_use_va
*** 1377,1389 ****
if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
/* ??? Better adjust the interface to that function
instead of building new trees here. */
! && forward_propagate_addr_expr (lhs,
! build1 (ADDR_EXPR,
! TREE_TYPE (rhs),
! build2 (MEM_REF,
! TREE_TYPE (TREE_TYPE (rhs)),
! rhs,
! fold_convert (ptr_type_node, gimple_assign_rhs2 (stmt))))))
{
release_defs (stmt);
todoflags |= TODO_remove_unused_locals;
--- 1377,1392 ----
if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
/* ??? Better adjust the interface to that function
instead of building new trees here. */
! && forward_propagate_addr_expr
! (lhs,
! build1 (ADDR_EXPR,
! TREE_TYPE (rhs),
! fold_build2 (MEM_REF,
! TREE_TYPE (TREE_TYPE (rhs)),
! rhs,
! fold_convert
! (ptr_type_node,
! gimple_assign_rhs2 (stmt))))))
{
release_defs (stmt);
todoflags |= TODO_remove_unused_locals;