summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2011-06-29 16:02:56 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-06-29 16:02:56 +0000
commit931050d044409ae6f3e18ac2fe4128e1e2bee11b (patch)
treeec4c6de260e96259274f75556d8c508f71b8f061 /gcc/tree-ssa-forwprop.c
parentf732fa7b6cd8f125f19aa150d88d47a15e0099cc (diff)
downloadgcc-931050d044409ae6f3e18ac2fe4128e1e2bee11b.tar.gz
re PR tree-optimization/49539 (ICE building gnattools)
PR tree-optimization/49539 * tree-ssa-forwprop.c (can_propagate_from): Check for abnormal SSA names by means of stmt_references_abnormal_ssa_name. (associate_plusminus): Call can_propagate_from before propagating from definition statements. (ssa_forward_propagate_and_combine): Remove superfluous newline. From-SVN: r175650
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 27453dd9720..e93acdfc081 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -260,9 +260,6 @@ get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
static bool
can_propagate_from (gimple def_stmt)
{
- use_operand_p use_p;
- ssa_op_iter iter;
-
gcc_assert (is_gimple_assign (def_stmt));
/* If the rhs has side-effects we cannot propagate from it. */
@@ -280,9 +277,8 @@ can_propagate_from (gimple def_stmt)
return true;
/* We cannot propagate ssa names that occur in abnormal phi nodes. */
- 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 (stmt_references_abnormal_ssa_name (def_stmt))
+ 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
@@ -1803,7 +1799,8 @@ associate_plusminus (gimple stmt)
{
gimple def_stmt = SSA_NAME_DEF_STMT (rhs2);
if (is_gimple_assign (def_stmt)
- && gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR)
+ && gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR
+ && can_propagate_from (def_stmt))
{
code = (code == MINUS_EXPR) ? PLUS_EXPR : MINUS_EXPR;
gimple_assign_set_rhs_code (stmt, code);
@@ -1820,7 +1817,8 @@ associate_plusminus (gimple stmt)
{
gimple def_stmt = SSA_NAME_DEF_STMT (rhs1);
if (is_gimple_assign (def_stmt)
- && gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR)
+ && gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR
+ && can_propagate_from (def_stmt))
{
code = MINUS_EXPR;
gimple_assign_set_rhs_code (stmt, code);
@@ -1863,7 +1861,7 @@ associate_plusminus (gimple stmt)
if (TREE_CODE (rhs1) == SSA_NAME)
{
gimple def_stmt = SSA_NAME_DEF_STMT (rhs1);
- if (is_gimple_assign (def_stmt))
+ if (is_gimple_assign (def_stmt) && can_propagate_from (def_stmt))
{
enum tree_code def_code = gimple_assign_rhs_code (def_stmt);
if (def_code == PLUS_EXPR
@@ -1963,7 +1961,7 @@ associate_plusminus (gimple stmt)
if (rhs2 && TREE_CODE (rhs2) == SSA_NAME)
{
gimple def_stmt = SSA_NAME_DEF_STMT (rhs2);
- if (is_gimple_assign (def_stmt))
+ if (is_gimple_assign (def_stmt) && can_propagate_from (def_stmt))
{
enum tree_code def_code = gimple_assign_rhs_code (def_stmt);
if (def_code == PLUS_EXPR
@@ -2285,8 +2283,7 @@ ssa_forward_propagate_and_combine (void)
else
gsi_next (&gsi);
}
- else if (code == POINTER_PLUS_EXPR
- && can_propagate_from (stmt))
+ else if (code == POINTER_PLUS_EXPR && can_propagate_from (stmt))
{
if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
/* ??? Better adjust the interface to that function