diff options
author | Martin Jambor <mjambor@suse.cz> | 2021-11-16 10:44:54 +0100 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2021-11-16 10:45:46 +0100 |
commit | 23125fab7b16f1aa61dfec69092786dc6d215732 (patch) | |
tree | f93ba740e6076e7d6e36a9cd77ffea93ceea0968 /gcc/tree-inline.c | |
parent | 9f7fc82014626173bd2c9effa8d8dcb3abd9b06c (diff) | |
download | gcc-23125fab7b16f1aa61dfec69092786dc6d215732.zip gcc-23125fab7b16f1aa61dfec69092786dc6d215732.tar.gz gcc-23125fab7b16f1aa61dfec69092786dc6d215732.tar.bz2 |
Replace more DEBUG_EXPR_DECL creations with build_debug_expr_decl
As discussed on the mailing list, this patch replaces all but one
remaining open coded constructions of DEBUG_EXPR_DECL with calls to
build_debug_expr_decl, even if - in order not to introduce any
functional change - the mode of the constructed decl is then
overwritten.
It is not clear if changing the mode has any effect in practice and
therefore I have added a FIXME note to code which does it, as
requested.
After this patch, DEBUG_EXPR_DECLs are created only by
build_debug_expr_decl and make_debug_expr_from_rtl which looks like
it should be left alone.
gcc/ChangeLog:
2021-11-11 Martin Jambor <mjambor@suse.cz>
* cfgexpand.c (expand_gimple_basic_block): Use build_debug_expr_decl,
add a fixme note about the mode assignment perhaps being unnecessary.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call):
Likewise.
(ipa_param_body_adjustments::mark_dead_statements): Likewise.
(ipa_param_body_adjustments::reset_debug_stmts): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
(tree_function_versioning): Likewise.
* tree-into-ssa.c (rewrite_debug_stmt_uses): Likewise.
* tree-ssa-loop-ivopts.c (remove_unused_ivs): Likewise.
* tree-ssa.c (insert_debug_temp_for_var_def): Likewise.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 53d664e..8c108d8 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -193,7 +193,6 @@ remap_ssa_name (tree name, copy_body_data *id) && id->entry_bb == NULL && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (cfun))) { - tree vexpr = make_node (DEBUG_EXPR_DECL); gimple *def_temp; gimple_stmt_iterator gsi; tree val = SSA_NAME_VAR (name); @@ -210,10 +209,10 @@ remap_ssa_name (tree name, copy_body_data *id) n = id->decl_map->get (val); if (n && TREE_CODE (*n) == DEBUG_EXPR_DECL) return *n; - def_temp = gimple_build_debug_source_bind (vexpr, val, NULL); - DECL_ARTIFICIAL (vexpr) = 1; - TREE_TYPE (vexpr) = TREE_TYPE (name); + tree vexpr = build_debug_expr_decl (TREE_TYPE (name)); + /* FIXME: Is setting the mode really necessary? */ SET_DECL_MODE (vexpr, DECL_MODE (SSA_NAME_VAR (name))); + def_temp = gimple_build_debug_source_bind (vexpr, val, NULL); gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun))); gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT); insert_decl_map (id, val, vexpr); @@ -6450,9 +6449,8 @@ tree_function_versioning (tree old_decl, tree new_decl, debug_args = decl_debug_args_insert (new_decl); len = vec_safe_length (*debug_args); } - ddecl = make_node (DEBUG_EXPR_DECL); - DECL_ARTIFICIAL (ddecl) = 1; - TREE_TYPE (ddecl) = TREE_TYPE (parm); + ddecl = build_debug_expr_decl (TREE_TYPE (parm)); + /* FIXME: Is setting the mode really necessary? */ SET_DECL_MODE (ddecl, DECL_MODE (parm)); vec_safe_push (*debug_args, DECL_ORIGIN (parm)); vec_safe_push (*debug_args, ddecl); @@ -6488,9 +6486,8 @@ tree_function_versioning (tree old_decl, tree new_decl, vexpr = *d; if (!vexpr) { - vexpr = make_node (DEBUG_EXPR_DECL); - DECL_ARTIFICIAL (vexpr) = 1; - TREE_TYPE (vexpr) = TREE_TYPE (parm); + vexpr = build_debug_expr_decl (TREE_TYPE (parm)); + /* FIXME: Is setting the mode really necessary? */ SET_DECL_MODE (vexpr, DECL_MODE (parm)); } def_temp = gimple_build_debug_bind (var, vexpr, NULL); |