Commit 9e11641d by Richard Guenther Committed by Richard Biener

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
parent 3fe1efe4
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> 2008-07-02 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c: Included timevar.h which I forgot before. * tree-switch-conversion.c: Included timevar.h which I forgot before.
......
...@@ -257,42 +257,27 @@ static bool ...@@ -257,42 +257,27 @@ static bool
can_propagate_from (tree def_stmt) can_propagate_from (tree def_stmt)
{ {
tree rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); 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 the rhs has side-effects we cannot propagate from it. */
if (TREE_SIDE_EFFECTS (rhs)) if (TREE_SIDE_EFFECTS (rhs))
return false; return false;
/* If the rhs is a load we cannot propagate from it. */ /* 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; return false;
/* Constants can be always propagated. */ /* Constants can be always propagated. */
if (is_gimple_min_invariant (rhs)) if (is_gimple_min_invariant (rhs))
return true; return true;
/* We cannot propagate ssa names that occur in abnormal phi nodes. */ /* If any of the SSA operands occurs in abnormal PHIs we cannot
switch (TREE_CODE_LENGTH (TREE_CODE (rhs))) propagate from this stmt. */
{ FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE)
case 3: if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (use_p)))
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; return false;
break;
default:
return false;
}
/* If the definition is a conversion of a pointer to a function type, /* If the definition is a conversion of a pointer to a function type,
then we can not apply optimizations as some targets require function then we can not apply optimizations as some targets require function
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment