aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2013-04-08 15:46:00 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-04-08 15:46:00 +0200
commitf223bb136269cc62ae94cc5d382e08be53b47acd (patch)
treea3858d5e8ddd0ca9b466d3525480cd3308ad2bfb /gcc/tree-ssa-ccp.c
parent4481581f34be81348f36276e290c80d59fbf49c6 (diff)
downloadgcc-f223bb136269cc62ae94cc5d382e08be53b47acd.zip
gcc-f223bb136269cc62ae94cc5d382e08be53b47acd.tar.gz
gcc-f223bb136269cc62ae94cc5d382e08be53b47acd.tar.bz2
re PR c++/34949 (Dead code in empty destructors.)
PR c++/34949 PR c++/50243 * tree-eh.c (optimize_clobbers): Only remove clobbers if bb doesn't contain anything but clobbers, at most one __builtin_stack_restore, optionally debug stmts and final resx, and if it has at least one incoming EH edge. Don't check for SSA_NAME on LHS of a clobber. (sink_clobbers): Don't check for SSA_NAME on LHS of a clobber. Instead of moving clobbers with MEM_REF LHS with SSA_NAME address which isn't defaut definition, remove them. (unsplit_eh, cleanup_empty_eh): Use single_{pred,succ}_{p,edge} instead of EDGE_COUNT comparisons or EDGE_{PRED,SUCC}. * tree-ssa-ccp.c (execute_fold_all_builtins): Remove clobbers with MEM_REF LHS with SSA_NAME address. * g++.dg/opt/vt3.C: New test. * g++.dg/opt/vt4.C: New test. From-SVN: r197580
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index a64bffc..f298b27 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2396,6 +2396,21 @@ execute_fold_all_builtins (void)
if (gimple_code (stmt) != GIMPLE_CALL)
{
+ /* Remove all *ssaname_N ={v} {CLOBBER}; stmts,
+ after the last GIMPLE DSE they aren't needed and might
+ unnecessarily keep the SSA_NAMEs live. */
+ if (gimple_clobber_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if (TREE_CODE (lhs) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME)
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&i, true);
+ release_defs (stmt);
+ continue;
+ }
+ }
gsi_next (&i);
continue;
}