summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-08 13:46:00 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-08 13:46:00 +0000
commit896a0c429a847ebbda7f33d67d7e53f2757a4260 (patch)
treea3858d5e8ddd0ca9b466d3525480cd3308ad2bfb /gcc/tree-ssa-ccp.c
parentd701b871e8562defb7f0de069fb925d6ab2ad597 (diff)
downloadgcc-896a0c429a847ebbda7f33d67d7e53f2757a4260.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197580 138bc75d-0d04-0410-961f-82ee72b054a4
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 a64bffcaec7..f298b27ad97 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;
}