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.
From-SVN: r101789
+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
2005-07-08 Kazu Hirata <kazu@codesourcery.com>
PR tree-optimization/22360
+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
2005-07-08 Kazu Hirata <kazu@codesourcery.com>
PR tree-optimization/20139
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+int f(int i)
+{
+ int k = 0;
+ if (i == 0)
+ k = i == 0;
+ return k;
+}
fold_predicate_in (tree stmt)
{
tree *pred_p = NULL;
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)))
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
else if (TREE_CODE (stmt) == COND_EXPR)
pred_p = &COND_EXPR_COND (stmt);
else
val = vrp_evaluate_conditional (*pred_p, true);
if (val)
{
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 ");
if (dump_file)
{
fprintf (dump_file, "Folding predicate ");