From 23125fab7b16f1aa61dfec69092786dc6d215732 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Tue, 16 Nov 2021 10:44:54 +0100 Subject: 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 * 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. --- gcc/cfgexpand.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gcc/cfgexpand.c') diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 55ff75b..eb6466f 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -5898,18 +5898,17 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) temporary. */ gimple *debugstmt; tree value = gimple_assign_rhs_to_tree (def); - tree vexpr = make_node (DEBUG_EXPR_DECL); + tree vexpr = build_debug_expr_decl (TREE_TYPE (value)); rtx val; machine_mode mode; set_curr_insn_location (gimple_location (def)); - DECL_ARTIFICIAL (vexpr) = 1; - TREE_TYPE (vexpr) = TREE_TYPE (value); if (DECL_P (value)) mode = DECL_MODE (value); else mode = TYPE_MODE (TREE_TYPE (value)); + /* FIXME: Is setting the mode really necessary? */ SET_DECL_MODE (vexpr, mode); val = gen_rtx_VAR_LOCATION -- cgit v1.1