gimple-fold.c (get_maxval_strlen): Move COND_EXPR handling under GIMPLE_ASSIGN.

2012-05-16  Andrew Pinski  <apinski@cavium.com>

	* gimple-fold.c (get_maxval_strlen): Move COND_EXPR handling under
	GIMPLE_ASSIGN.

From-SVN: r187609
This commit is contained in:
Andrew Pinski 2012-05-16 20:38:25 +00:00 committed by Andrew Pinski
parent bab9f63515
commit 757c35c4b1
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2012-05-16 Andrew Pinski <apinski@cavium.com>
* gimple-fold.c (get_maxval_strlen): Move COND_EXPR handling under
GIMPLE_ASSIGN.
2012-05-16 David S. Miller <davem@davemloft.net>
* jump.c (delete_related_insns): If we remove a CALL, make sure

View File

@ -671,13 +671,10 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
if (TREE_CODE (arg) != SSA_NAME)
{
if (TREE_CODE (arg) == COND_EXPR)
return get_maxval_strlen (COND_EXPR_THEN (arg), length, visited, type)
&& get_maxval_strlen (COND_EXPR_ELSE (arg), length, visited, type);
/* We can end up with &(*iftmp_1)[0] here as well, so handle it. */
else if (TREE_CODE (arg) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (arg, 0)) == ARRAY_REF
&& integer_zerop (TREE_OPERAND (TREE_OPERAND (arg, 0), 1)))
if (TREE_CODE (arg) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (arg, 0)) == ARRAY_REF
&& integer_zerop (TREE_OPERAND (TREE_OPERAND (arg, 0), 1)))
{
tree aop0 = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
if (TREE_CODE (aop0) == INDIRECT_REF
@ -737,6 +734,13 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
tree rhs = gimple_assign_rhs1 (def_stmt);
return get_maxval_strlen (rhs, length, visited, type);
}
else if (gimple_assign_rhs_code (def_stmt) == COND_EXPR)
{
tree op2 = gimple_assign_rhs2 (def_stmt);
tree op3 = gimple_assign_rhs3 (def_stmt);
return get_maxval_strlen (op2, length, visited, type)
&& get_maxval_strlen (op3, length, visited, type);
}
return false;
case GIMPLE_PHI: