gimple-fold.c (fold_stmt_1): Check may_propagate_copy before valueizing return stmts.
authorRichard Biener <rguenther@suse.de>
Fri, 25 Nov 2016 11:40:30 +0000 (11:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 25 Nov 2016 11:40:30 +0000 (11:40 +0000)
2016-11-25  Richard Biener  <rguenther@suse.de>

* gimple-fold.c (fold_stmt_1): Check may_propagate_copy
before valueizing return stmts.

From-SVN: r242873

gcc/ChangeLog
gcc/gimple-fold.c

index 9681566..0c0fce9 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-25  Richard Biener  <rguenther@suse.de>
+
+       * gimple-fold.c (fold_stmt_1): Check may_propagate_copy
+       before valueizing return stmts.
+
 2016-11-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/78343
index 6842301..f586c09 100644 (file)
@@ -4414,7 +4414,8 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree))
        if (ret && TREE_CODE (ret) == SSA_NAME && valueize)
          {
            tree val = valueize (ret);
-           if (val && val != ret)
+           if (val && val != ret
+               && may_propagate_copy (ret, val))
              {
                gimple_return_set_retval (ret_stmt, val);
                changed = true;