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 9681566de997edbbfcfe789c134f83d94e27c021..0c0fce9b7d0caf061449ff936c6b908de462ec99 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 684230161187dc3791f92878e900906b7eed47f3..f586c0933d5fb5351e6d3e3e3e206e23eaa8057b 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;