From 1af928db7cd28e28e044f45760f11e0667d3fcbc Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 25 Nov 2016 11:40:30 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/gimple-fold.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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; -- 2.30.2