diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-16 20:22:03 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-16 20:22:03 +0000 |
commit | 1eaedae67937a002e43db2b990e711157c4038ce (patch) | |
tree | 367528823c752fbc5fb3617b3bf2902eafce4aa2 | |
parent | ad35ffdcc7888aed602d86331506e63c17058b75 (diff) | |
download | gcc-1eaedae67937a002e43db2b990e711157c4038ce.tar.gz |
2012-05-16 Andrew Pinski <apinski@cavium.com>
* gimple-fold.c (get_maxval_strlen): Move COND_EXPR handling under
GIMPLE_ASSIGN.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187608 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6715f30cb7a..b05a5b573d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ee8b4d14d7c..b6f01430bb1 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -670,13 +670,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 @@ -736,6 +733,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: |