diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-04-02 20:25:36 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-04-02 20:25:36 +0200 |
commit | 5d751b0c970f54e3a99a177d4b2d77db81116e09 (patch) | |
tree | 4ee3c2b7dfdc5ebe044adb7a6e509a7d8ffa2e13 /gcc/tree-ssa-dse.c | |
parent | e594716a6a02ffcc0a33862ff6ea8325ac2263e8 (diff) | |
download | gcc-5d751b0c970f54e3a99a177d4b2d77db81116e09.zip gcc-5d751b0c970f54e3a99a177d4b2d77db81116e09.tar.gz gcc-5d751b0c970f54e3a99a177d4b2d77db81116e09.tar.bz2 |
re PR c++/34949 (Dead code in empty destructors.)
PR c++/34949
* tree-cfg.c (verify_gimple_assign_single): Allow lhs
of gimple_clobber_p to be MEM_REF.
* gimplify.c (gimplify_modify_expr): Gimplify *to_p of
an assignment from TREE_CLOBBER_P. Allow it to be MEM_REF
after gimplification.
* asan.c (get_mem_ref_of_assignment): Don't instrument
gimple_clobber_p stmts.
* tree-ssa-dse.c (dse_optimize_stmt): Allow DSE of
gimple_clobber_p stmt if they have MEM_REF lhs and
are dead because of another gimple_clobber_p stmt.
* tree-ssa-live.c (clear_unused_block_pointer): Treat
gimple_clobber_p stmts like debug stmts.
(remove_unused_locals): Remove clobbers with MEM_REF lhs
that refer to unused VAR_DECLs or uninitialized values.
* tree-sra.c (sra_ipa_reset_debug_stmts): Also remove
gimple_clobber_p stmts if they refer to removed parameters.
(get_repl_default_def_ssa_name, sra_ipa_modify_expr): Fix up
formatting.
From-SVN: r197369
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r-- | gcc/tree-ssa-dse.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 223682b..e0c3b74 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -218,7 +218,10 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (is_gimple_call (stmt) && gimple_call_fndecl (stmt)) return; - if (gimple_has_volatile_ops (stmt)) + /* Don't return early on *this_2(D) ={v} {CLOBBER}. */ + if (gimple_has_volatile_ops (stmt) + && (!gimple_clobber_p (stmt) + || TREE_CODE (gimple_assign_lhs (stmt)) != MEM_REF)) return; if (is_gimple_assign (stmt)) @@ -228,6 +231,12 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (!dse_possible_dead_store_p (stmt, &use_stmt)) return; + /* But only remove *this_2(D) ={v} {CLOBBER} if killed by + another clobber stmt. */ + if (gimple_clobber_p (stmt) + && !gimple_clobber_p (use_stmt)) + return; + /* If we have precisely one immediate use at this point and the stores are to the same memory location or there is a chain of virtual uses from stmt and the stmt which stores to that same |