tree-ssa-forwprop.c (can_propagate_from): Exclude loads from decls explicitly.

2008-07-02  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-forwprop.c (can_propagate_from): Exclude loads
	from decls explicitly.  Merge operand checking from tuples.

From-SVN: r137352
This commit is contained in:
Richard Guenther 2008-07-02 11:25:26 +00:00 committed by Richard Biener
parent 3fe1efe4d0
commit 9e11641d11
2 changed files with 13 additions and 23 deletions

View File

@ -1,3 +1,8 @@
2008-07-02 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (can_propagate_from): Exclude loads
from decls explicitly. Merge operand checking from tuples.
2008-07-02 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c: Included timevar.h which I forgot before.

View File

@ -257,42 +257,27 @@ static bool
can_propagate_from (tree def_stmt)
{
tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
use_operand_p use_p;
ssa_op_iter iter;
/* If the rhs has side-effects we cannot propagate from it. */
if (TREE_SIDE_EFFECTS (rhs))
return false;
/* If the rhs is a load we cannot propagate from it. */
if (REFERENCE_CLASS_P (rhs))
if (REFERENCE_CLASS_P (rhs)
|| DECL_P (rhs))
return false;
/* Constants can be always propagated. */
if (is_gimple_min_invariant (rhs))
return true;
/* We cannot propagate ssa names that occur in abnormal phi nodes. */
switch (TREE_CODE_LENGTH (TREE_CODE (rhs)))
{
case 3:
if (TREE_OPERAND (rhs, 2) != NULL_TREE
&& TREE_CODE (TREE_OPERAND (rhs, 2)) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 2)))
return false;
case 2:
if (TREE_OPERAND (rhs, 1) != NULL_TREE
&& TREE_CODE (TREE_OPERAND (rhs, 1)) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 1)))
return false;
case 1:
if (TREE_OPERAND (rhs, 0) != NULL_TREE
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (rhs, 0)))
return false;
break;
default:
/* If any of the SSA operands occurs in abnormal PHIs we cannot
propagate from this stmt. */
FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE)
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (use_p)))
return false;
}
/* If the definition is a conversion of a pointer to a function type,
then we can not apply optimizations as some targets require function