diff options
author | Richard Biener <rguenther@suse.de> | 2017-03-23 08:33:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-03-23 08:33:41 +0000 |
commit | cda4d053eb376f75e990d550a96c4180ec69f514 (patch) | |
tree | e3de8f5339854801966d9afe66e53b0f1bf6da3d | |
parent | d1b8f791643e83e95d49740e1061356216d5cc7c (diff) | |
download | gcc-cda4d053eb376f75e990d550a96c4180ec69f514.zip gcc-cda4d053eb376f75e990d550a96c4180ec69f514.tar.gz gcc-cda4d053eb376f75e990d550a96c4180ec69f514.tar.bz2 |
re PR tree-optimization/80032 (C++ excessive stack usage (no stack reuse))
2017-03-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/80032
* gimplify.c (gimple_push_cleanup): Forced unconditional
cleanups still have to go to the conditional_cleanups
sequence.
From-SVN: r246414
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gimplify.c | 37 |
2 files changed, 30 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 205de5c..ddf90e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-03-23 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80032 + * gimplify.c (gimple_push_cleanup): Forced unconditional + cleanups still have to go to the conditional_cleanups + sequence. + 2017-03-22 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/80072 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f90ae94..6deac4a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6312,7 +6312,7 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p, if (seen_error ()) return; - if (gimple_conditional_context () && ! force_uncond) + if (gimple_conditional_context ()) { /* If we're in a conditional context, this is more complex. We only want to run the cleanup if we actually ran the initialization that @@ -6334,22 +6334,31 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p, } val */ - tree flag = create_tmp_var (boolean_type_node, "cleanup"); - gassign *ffalse = gimple_build_assign (flag, boolean_false_node); - gassign *ftrue = gimple_build_assign (flag, boolean_true_node); + if (force_uncond) + { + gimplify_stmt (&cleanup, &cleanup_stmts); + wce = gimple_build_wce (cleanup_stmts); + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); + } + else + { + tree flag = create_tmp_var (boolean_type_node, "cleanup"); + gassign *ffalse = gimple_build_assign (flag, boolean_false_node); + gassign *ftrue = gimple_build_assign (flag, boolean_true_node); - cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL); - gimplify_stmt (&cleanup, &cleanup_stmts); - wce = gimple_build_wce (cleanup_stmts); + cleanup = build3 (COND_EXPR, void_type_node, flag, cleanup, NULL); + gimplify_stmt (&cleanup, &cleanup_stmts); + wce = gimple_build_wce (cleanup_stmts); - gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, ffalse); - gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); - gimplify_seq_add_stmt (pre_p, ftrue); + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, ffalse); + gimplify_seq_add_stmt (&gimplify_ctxp->conditional_cleanups, wce); + gimplify_seq_add_stmt (pre_p, ftrue); - /* Because of this manipulation, and the EH edges that jump - threading cannot redirect, the temporary (VAR) will appear - to be used uninitialized. Don't warn. */ - TREE_NO_WARNING (var) = 1; + /* Because of this manipulation, and the EH edges that jump + threading cannot redirect, the temporary (VAR) will appear + to be used uninitialized. Don't warn. */ + TREE_NO_WARNING (var) = 1; + } } else { |