diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-08 19:26:16 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-08 19:26:16 +0000 |
commit | 90babe1f4440a87979601643fb8510c21434ad91 (patch) | |
tree | d8ba1b61150f89c23c97e3b4449de2ef40b5749a | |
parent | 10320e23afd6fc7f4ddca62b603000a33b12f48f (diff) | |
download | linaro-gcc-90babe1f4440a87979601643fb8510c21434ad91.tar.gz linaro-gcc-90babe1f4440a87979601643fb8510c21434ad91.tar.bz2 linaro-gcc-90babe1f4440a87979601643fb8510c21434ad91.zip |
2005-07-08 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/22329
* gcc.dg/pr22329.c: New test.
2005-07-08 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/22329
* tree-ssa-propagate.c (fold_predicate_in): Convert the value
to the correct type if we have a MODIFY_EXPR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101789 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr22329.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.c | 9 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index adceec9b310..2c169d2cc93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-07-08 Andrew Pinski <pinskia@physics.uc.edu> + + PR tree-opt/22329 + * tree-ssa-propagate.c (fold_predicate_in): Convert the value + to the correct type if we have a MODIFY_EXPR. + 2005-07-08 Kazu Hirata <kazu@codesourcery.com> PR tree-optimization/22360 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 862e457baff..f61b47363cd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-07-08 Andrew Pinski <pinskia@physics.uc.edu> + + PR tree-opt/22329 + * gcc.dg/pr22329.c: New test. + 2005-07-08 Kazu Hirata <kazu@codesourcery.com> PR tree-optimization/20139 diff --git a/gcc/testsuite/gcc.dg/pr22329.c b/gcc/testsuite/gcc.dg/pr22329.c new file mode 100644 index 00000000000..94e32d69593 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr22329.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +int f(int i) +{ + int k = 0; + if (i == 0) + k = i == 0; + return k; +} diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index b9b308e6078..07b13e3fa5f 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -1018,11 +1018,15 @@ static bool fold_predicate_in (tree stmt) { tree *pred_p = NULL; + bool modify_expr_p = false; tree val; if (TREE_CODE (stmt) == MODIFY_EXPR && COMPARISON_CLASS_P (TREE_OPERAND (stmt, 1))) - pred_p = &TREE_OPERAND (stmt, 1); + { + modify_expr_p = true; + pred_p = &TREE_OPERAND (stmt, 1); + } else if (TREE_CODE (stmt) == COND_EXPR) pred_p = &COND_EXPR_COND (stmt); else @@ -1031,6 +1035,9 @@ fold_predicate_in (tree stmt) val = vrp_evaluate_conditional (*pred_p, true); if (val) { + if (modify_expr_p) + val = fold_convert (TREE_TYPE (*pred_p), val); + if (dump_file) { fprintf (dump_file, "Folding predicate "); |