tree-ssa-sccvn.c (try_to_simplify): Use valid_gimple_expression

2007-07-18  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-sccvn.c (try_to_simplify): Use valid_gimple_expression
	* tree-ssa-propagate (valid_gimple_expression): Handle ADDR_EXPR
	properly.

From-SVN: r126721
This commit is contained in:
Daniel Berlin 2007-07-18 15:44:28 +00:00 committed by Daniel Berlin
parent 9e19a50c89
commit c3e4e34df9
3 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2007-07-18 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-sccvn.c (try_to_simplify): Use valid_gimple_expression
* tree-ssa-propagate (valid_gimple_expression): Handle ADDR_EXPR
properly.
2007-07-18 Rask Ingemann Lambertsen <rask@sygehus.dk>
PR target/32808

View File

@ -606,10 +606,21 @@ valid_gimple_expression_p (tree expr)
switch (code)
{
case ADDR_EXPR:
if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF
&& !is_gimple_val (TREE_OPERAND (TREE_OPERAND (expr, 0), 1)))
return false;
break;
{
tree t = TREE_OPERAND (expr, 0);
while (handled_component_p (t))
{
/* ??? More checks needed, see the GIMPLE verifier. */
if ((TREE_CODE (t) == ARRAY_REF
|| TREE_CODE (t) == ARRAY_RANGE_REF)
&& !is_gimple_val (TREE_OPERAND (t, 1)))
return false;
t = TREE_OPERAND (t, 0);
}
if (!is_gimple_addressable (t))
return false;
break;
}
case TRUTH_NOT_EXPR:
if (!is_gimple_val (TREE_OPERAND (expr, 0)))

View File

@ -1437,7 +1437,7 @@ try_to_simplify (tree stmt, tree rhs)
if (TREE_READONLY (rhs)
&& TREE_STATIC (rhs)
&& DECL_INITIAL (rhs)
&& is_gimple_min_invariant (DECL_INITIAL (rhs)))
&& valid_gimple_expression_p (DECL_INITIAL (rhs)))
return DECL_INITIAL (rhs);
/* Fallthrough. */