diff options
Diffstat (limited to 'gcc/cp/cp-gimplify.cc')
-rw-r--r-- | gcc/cp/cp-gimplify.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index b011bad..623e2ee 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -1470,13 +1470,19 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) if (data->flags & ff_genericize) cp_genericize_target_expr (stmt_p); - /* Folding might replace e.g. a COND_EXPR with a TARGET_EXPR; in - that case, strip it in favor of this one. */ if (tree &init = TARGET_EXPR_INITIAL (stmt)) { cp_walk_tree (&init, cp_fold_r, data, NULL); cp_walk_tree (&TARGET_EXPR_CLEANUP (stmt), cp_fold_r, data, NULL); *walk_subtrees = 0; + if (!flag_no_inline) + { + tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt)); + if (folded != init && TREE_CONSTANT (folded)) + init = folded; + } + /* Folding might replace e.g. a COND_EXPR with a TARGET_EXPR; in + that case, strip it in favor of this one. */ if (TREE_CODE (init) == TARGET_EXPR) { tree sub = TARGET_EXPR_INITIAL (init); |