diff options
author | Richard Biener <rguenther@suse.de> | 2017-03-21 11:43:45 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-03-21 11:43:45 +0000 |
commit | e650ea2a5efcd806b5f1aafc2db980d083fbfd7c (patch) | |
tree | b7ff424f8729b56a0c9c67b0f850a1672a1c2b49 /gcc/gimplify.c | |
parent | da2ce5f993367610a67df1367665dda8a0abc354 (diff) | |
download | gcc-e650ea2a5efcd806b5f1aafc2db980d083fbfd7c.zip gcc-e650ea2a5efcd806b5f1aafc2db980d083fbfd7c.tar.gz gcc-e650ea2a5efcd806b5f1aafc2db980d083fbfd7c.tar.bz2 |
re PR tree-optimization/80032 (C++ excessive stack usage (no stack reuse))
2017-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/80032
* gimplify.c (gimple_push_cleanup): Add force_uncond parameter,
if set force the cleanup to happen unconditionally.
(gimplify_target_expr): Push inserted clobbers with force_uncond
to avoid them being removed by control-dependent DCE.
* g++.dg/opt/pr80032.C: New testcase.
From-SVN: r246314
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fbf136f..06f984c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6288,10 +6288,13 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p) /* Insert a cleanup marker for gimplify_cleanup_point_expr. CLEANUP is the cleanup action required. EH_ONLY is true if the cleanup should - only be executed if an exception is thrown, not on normal exit. */ + only be executed if an exception is thrown, not on normal exit. + If FORCE_UNCOND is true perform the cleanup unconditionally; this is + only valid for clobbers. */ static void -gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) +gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p, + bool force_uncond = false) { gimple *wce; gimple_seq cleanup_stmts = NULL; @@ -6301,7 +6304,7 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) if (seen_error ()) return; - if (gimple_conditional_context ()) + if (gimple_conditional_context () && ! force_uncond) { /* 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 @@ -6426,11 +6429,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) NULL); TREE_THIS_VOLATILE (clobber) = true; clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber); - if (cleanup) - cleanup = build2 (COMPOUND_EXPR, void_type_node, cleanup, - clobber); - else - cleanup = clobber; + gimple_push_cleanup (temp, clobber, false, pre_p, true); } if (asan_poisoned_variables && dbg_cnt (asan_use_after_scope)) { |