From 931050d044409ae6f3e18ac2fe4128e1e2bee11b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 29 Jun 2011 16:02:56 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 11 ++++++++++- gcc/tree-ssa-forwprop.c | 21 +++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a639958269..e37d823b42b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-06-29 Eric Botcazou + + 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. + 2011-06-29 Richard Guenther * doc/invoke.texi: Document -scev dump modifier. @@ -963,7 +972,7 @@ 2011-06-20 Changpeng Fang - PR i386/49089 + PR target/49089 * config/i386/i386.c (avx256_split_unaligned_load): New definition. (avx256_split_unaligned_store): New definition. (ix86_option_override_internal): Enable avx256 unaligned load/store 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 -- 2.30.2