From: Richard Biener Date: Fri, 25 Nov 2016 11:40:30 +0000 (+0000) Subject: gimple-fold.c (fold_stmt_1): Check may_propagate_copy before valueizing return stmts. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1af928db7cd28e28e044f45760f11e0667d3fcbc;p=gcc.git gimple-fold.c (fold_stmt_1): Check may_propagate_copy before valueizing return stmts. 2016-11-25 Richard Biener * gimple-fold.c (fold_stmt_1): Check may_propagate_copy before valueizing return stmts. From-SVN: r242873 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9681566de99..0c0fce9b7d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-11-25 Richard Biener + + * gimple-fold.c (fold_stmt_1): Check may_propagate_copy + before valueizing return stmts. + 2016-11-24 Richard Biener PR tree-optimization/78343 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 68423016118..f586c0933d5 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -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;