Commit c3e4e34d by Daniel Berlin Committed by Daniel Berlin

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
parent 9e19a50c
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
......
......@@ -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)))
......
......@@ -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. */
......
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