aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
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;