aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-12-01 20:12:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-12-01 20:12:54 +0100
commitec8c1492af9156d96527104f7e7db806220e56c8 (patch)
treea0a8960c1902ff04d8b319d3ba88cf5c4f64534b /gcc/tree-ssa-dce.c
parente411850054322167de1ae23af2b7c9b7a1ac9029 (diff)
downloadgcc-ec8c1492af9156d96527104f7e7db806220e56c8.zip
gcc-ec8c1492af9156d96527104f7e7db806220e56c8.tar.gz
gcc-ec8c1492af9156d96527104f7e7db806220e56c8.tar.bz2
re PR debug/50317 (missing DW_OP_GNU_implicit_pointer)
PR debug/50317 * tree-ssa-dce.c (remove_dead_stmt): Add a debug stmt when removing as unnecessary a store to a variable with gimple reg type. * tree-ssa-live.c (remove_unused_locals): Clear TREE_ADDRESSABLE bit on local unreferenced variables. * cfgexpand.c (expand_gimple_basic_block): Don't emit DEBUG_INSNs for !target_for_debug_bind variables. From-SVN: r181890
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index d6fbe62..a710de6 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1215,6 +1215,26 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
ei_next (&ei);
}
+ /* If this is a store into a variable that is being optimized away,
+ add a debug bind stmt if possible. */
+ if (MAY_HAVE_DEBUG_STMTS
+ && gimple_assign_single_p (stmt)
+ && is_gimple_val (gimple_assign_rhs1 (stmt)))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if ((TREE_CODE (lhs) == VAR_DECL || TREE_CODE (lhs) == PARM_DECL)
+ && !DECL_IGNORED_P (lhs)
+ && is_gimple_reg_type (TREE_TYPE (lhs))
+ && !is_global_var (lhs)
+ && !DECL_HAS_VALUE_EXPR_P (lhs))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ gimple note
+ = gimple_build_debug_bind (lhs, unshare_expr (rhs), stmt);
+ gsi_insert_after (i, note, GSI_SAME_STMT);
+ }
+ }
+
unlink_stmt_vdef (stmt);
gsi_remove (i, true);
release_defs (stmt);