aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-10-05 21:24:38 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-10-05 21:24:38 +0200
commit878eef4ad8aa6858fe270ccb589d3eed4a05c8e3 (patch)
treef6eec448c0e3da89f23b49565a93609752d5a0a2 /gcc/tree-inline.c
parent3b1cd14dd034dec421712abbd95111a2c4fb08e1 (diff)
downloadgcc-878eef4ad8aa6858fe270ccb589d3eed4a05c8e3.zip
gcc-878eef4ad8aa6858fe270ccb589d3eed4a05c8e3.tar.gz
gcc-878eef4ad8aa6858fe270ccb589d3eed4a05c8e3.tar.bz2
re PR debug/54519 (Debug info quality regression due to (pointless) partial inlining)
PR debug/54519 * ipa-split.c (split_function): Add debug args and debug source and normal stmts for args_to_skip which are gimple regs. * tree-inline.c (copy_debug_stmt): When inlining, adjust source debug bind stmts to debug binds of corresponding DEBUG_EXPR_DECL. * gcc.dg/guality/pr54519-1.c: New test. * gcc.dg/guality/pr54519-2.c: New test. * gcc.dg/guality/pr54519-3.c: New test. * gcc.dg/guality/pr54519-4.c: New test. * gcc.dg/guality/pr54519-5.c: New test. * gcc.dg/guality/pr54519-6.c: New test. From-SVN: r192139
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index d6fbf50..04f87a3 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2374,6 +2374,31 @@ copy_debug_stmt (gimple stmt, copy_body_data *id)
gimple_debug_source_bind_set_var (stmt, t);
walk_tree (gimple_debug_source_bind_get_value_ptr (stmt),
remap_gimple_op_r, &wi, NULL);
+ /* When inlining and source bind refers to one of the optimized
+ away parameters, change the source bind into normal debug bind
+ referring to the corresponding DEBUG_EXPR_DECL that should have
+ been bound before the call stmt. */
+ t = gimple_debug_source_bind_get_value (stmt);
+ if (t != NULL_TREE
+ && TREE_CODE (t) == PARM_DECL
+ && id->gimple_call)
+ {
+ VEC(tree, gc) **debug_args = decl_debug_args_lookup (id->src_fn);
+ unsigned int i;
+ if (debug_args != NULL)
+ {
+ for (i = 0; i < VEC_length (tree, *debug_args); i += 2)
+ if (VEC_index (tree, *debug_args, i) == DECL_ORIGIN (t)
+ && TREE_CODE (VEC_index (tree, *debug_args, i + 1))
+ == DEBUG_EXPR_DECL)
+ {
+ t = VEC_index (tree, *debug_args, i + 1);
+ stmt->gsbase.subcode = GIMPLE_DEBUG_BIND;
+ gimple_debug_bind_set_value (stmt, t);
+ break;
+ }
+ }
+ }
}
processing_debug_stmt = 0;