+/* Copy the debug STMT using ID. We deal with these statements in a
+ special way: if any variable in their VALUE expression wasn't
+ remapped yet, we won't remap it, because that would get decl uids
+ out of sync, causing codegen differences between -g and -g0. If
+ this arises, we drop the VALUE expression altogether. */
+
+static void
+copy_debug_stmt (gimple stmt, copy_body_data *id)
+{
+ tree t, *n;
+ struct walk_stmt_info wi;
+
+ t = id->block;
+ if (gimple_block (stmt))
+ {
+ tree *n;
+ n = (tree *) pointer_map_contains (id->decl_map, gimple_block (stmt));
+ if (n)
+ t = *n;
+ }
+ gimple_set_block (stmt, t);
+
+ /* Remap all the operands in COPY. */
+ memset (&wi, 0, sizeof (wi));
+ wi.info = id;
+
+ processing_debug_stmt = 1;
+
+ t = gimple_debug_bind_get_var (stmt);
+
+ if (TREE_CODE (t) == PARM_DECL && id->debug_map
+ && (n = (tree *) pointer_map_contains (id->debug_map, t)))
+ {
+ gcc_assert (TREE_CODE (*n) == VAR_DECL);
+ t = *n;
+ }
+ else if (TREE_CODE (t) == VAR_DECL
+ && !TREE_STATIC (t)
+ && gimple_in_ssa_p (cfun)
+ && !pointer_map_contains (id->decl_map, t)
+ && !var_ann (t))
+ /* T is a non-localized variable. */;
+ else
+ walk_tree (&t, remap_gimple_op_r, &wi, NULL);
+
+ gimple_debug_bind_set_var (stmt, t);
+
+ if (gimple_debug_bind_has_value_p (stmt))
+ walk_tree (gimple_debug_bind_get_value_ptr (stmt),
+ remap_gimple_op_r, &wi, NULL);
+
+ /* Punt if any decl couldn't be remapped. */
+ if (processing_debug_stmt < 0)
+ gimple_debug_bind_reset_value (stmt);
+
+ processing_debug_stmt = 0;
+
+ update_stmt (stmt);
+ if (gimple_in_ssa_p (cfun))
+ mark_symbols_for_renaming (stmt);
+}
+
+/* Process deferred debug stmts. In order to give values better odds
+ of being successfully remapped, we delay the processing of debug
+ stmts until all other stmts that might require remapping are
+ processed. */
+
+static void
+copy_debug_stmts (copy_body_data *id)
+{
+ size_t i;
+ gimple stmt;
+
+ if (!id->debug_stmts)
+ return;
+
+ for (i = 0; VEC_iterate (gimple, id->debug_stmts, i, stmt); i++)
+ copy_debug_stmt (stmt, id);
+
+ VEC_free (gimple, heap, id->debug_stmts);
+}
+
+/* Make a copy of the body of SRC_FN so that it can be inserted inline in
+ another function. */
+