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

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
This commit is contained in:
Richard Biener 2016-11-25 11:40:30 +00:00 committed by Richard Biener
parent 59ec925b11
commit 1af928db7c
2 changed files with 7 additions and 1 deletions

View 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

View 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;