This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Cleanup some tuplification issues in forwprop
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 17 Apr 2009 20:15:37 +0200 (CEST)
- Subject: [PATCH] Cleanup some tuplification issues in forwprop
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2009-04-17 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (get_prop_dest_stmt): Clean up
tuplification.
(get_prop_source_stmt): Likewise.
(can_propagate_from): Likewise.
Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc/tree-ssa-forwprop.c (revision 146272)
--- gcc/tree-ssa-forwprop.c (working copy)
*************** get_prop_dest_stmt (tree name, tree *fin
*** 186,193 ****
return NULL;
/* If this is not a trivial copy, we found it. */
! if (!gimple_assign_copy_p (use_stmt)
! || TREE_CODE (gimple_assign_lhs (use_stmt)) != SSA_NAME
|| gimple_assign_rhs1 (use_stmt) != name)
break;
--- 186,192 ----
return NULL;
/* If this is not a trivial copy, we found it. */
! if (!gimple_assign_ssa_name_copy_p (use_stmt)
|| gimple_assign_rhs1 (use_stmt) != name)
break;
*************** get_prop_source_stmt (tree name, bool si
*** 225,236 ****
}
/* If name is defined by a PHI node or is the default def, bail out. */
! if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
return NULL;
! /* If name is not a simple copy destination, we found it. */
! if (!gimple_assign_copy_p (def_stmt)
! || TREE_CODE (gimple_assign_rhs1 (def_stmt)) != SSA_NAME)
{
tree rhs;
--- 224,234 ----
}
/* If name is defined by a PHI node or is the default def, bail out. */
! if (!is_gimple_assign (def_stmt))
return NULL;
! /* If def_stmt is not a simple copy, we possibly found it. */
! if (!gimple_assign_ssa_name_copy_p (def_stmt))
{
tree rhs;
*************** can_propagate_from (gimple def_stmt)
*** 266,271 ****
--- 264,270 ----
ssa_op_iter iter;
gcc_assert (is_gimple_assign (def_stmt));
+
/* If the rhs has side-effects we cannot propagate from it. */
if (gimple_has_volatile_ops (def_stmt))
return false;
*************** can_propagate_from (gimple def_stmt)
*** 276,283 ****
return false;
/* Constants can be always propagated. */
! if (is_gimple_min_invariant
! (rhs_to_tree (TREE_TYPE (gimple_assign_lhs (def_stmt)), def_stmt)))
return true;
/* We cannot propagate ssa names that occur in abnormal phi nodes. */
--- 275,282 ----
return false;
/* Constants can be always propagated. */
! if (gimple_assign_single_p (def_stmt)
! && is_gimple_min_invariant (gimple_assign_rhs1 (def_stmt)))
return true;
/* We cannot propagate ssa names that occur in abnormal phi nodes. */
*************** can_propagate_from (gimple def_stmt)
*** 289,302 ****
then we can not apply optimizations as some targets require
function pointers to be canonicalized and in this case this
optimization could eliminate a necessary canonicalization. */
! if (is_gimple_assign (def_stmt)
! && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))))
{
tree rhs = gimple_assign_rhs1 (def_stmt);
if (POINTER_TYPE_P (TREE_TYPE (rhs))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (rhs))) == FUNCTION_TYPE)
return false;
}
return true;
}
--- 288,301 ----
then we can not apply optimizations as some targets require
function pointers to be canonicalized and in this case this
optimization could eliminate a necessary canonicalization. */
! if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
{
tree rhs = gimple_assign_rhs1 (def_stmt);
if (POINTER_TYPE_P (TREE_TYPE (rhs))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (rhs))) == FUNCTION_TYPE)
return false;
}
+
return true;
}