This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][debug] Reuse debug exprs generated in remap_ssa_name


On Fri, Jul 13, 2018 at 12:09 PM Tom de Vries <tdevries@suse.de> wrote:
>
> On 07/09/2018 02:43 PM, Richard Biener wrote:
> > On Sun, Jul 8, 2018 at 11:27 AM Tom de Vries <tdevries@suse.de> wrote:
> >>
> >> On Sun, Jul 08, 2018 at 11:22:41AM +0200, Tom de Vries wrote:
> >>> On Fri, Jul 06, 2018 at 04:38:50PM +0200, Richard Biener wrote:
> >>>> On Fri, Jul 6, 2018 at 12:47 PM Tom de Vries <tdevries@suse.de> wrote:
> >>>>> On 07/05/2018 01:39 PM, Richard Biener wrote:
> >>>
> >>> <SNIP>
> >>>
> >>>> I now also spotted the code in remap_ssa_name that is supposed to handle
> >>>> this it seems and for the testcase we only give up because the PARM_DECL is
> >>>> remapped to a VAR_DECL.  So I suppose it is to be handled via the
> >>>> debug-args stuff
> >>>> which probably lacks in the area of versioning.
> >>>>
> >>>> Your patch feels like it adds stuff ontop of existing mechanisms that
> >>>> should "just work"
> >>>> with the correct setup at the correct places...
> >>>>
> >>>
> >>> Hmm, I realized that I may be complicating things, by trying to do an
> >>> optimal fix in a single patch, so I decided to write two patches, one
> >>> with a fix, and then one improving the fix to be more optimal.
> >>>
> >>> Also, I suspect that the "just work" approach is this:
> >>> ...
> >>>        # DEBUG D#8 s=> iD.1900
> >>>        # DEBUG iD.1949 => D#8
> >>>        # DEBUG D#6 s=> iD.1949
> >>> ...
> >>> whereas previously I tried to map 'D#6' on iD.1900 directly.
> >>>
> >>
> >> Second patch OK for trunk?
> >
> > OK, though I wonder how it doesn't fail with that testcase with
> > the mismatching type where the removed param-decl is mapped
> > to a local var-decl.
>
> Previously I mapped the default def ssa-name onto the debug expression,
> which meant I had to add special handling at the start of
> remap_ssa_name, where already mapped ssa-names are handled, for the
> mismatched argument/parameter type case.
>
> Now I map the local var-decl onto the debug expression, and the code
> that is added to look it up is already guarded with processing_debug_stmt.

Ah, thanks for the explanation!

Richard.

> Thanks,
> - Tom
>
> >> diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> >> index 6fbd8c3ca61..164c7fff710 100644
> >> --- a/gcc/tree-inline.c
> >> +++ b/gcc/tree-inline.c
> >> @@ -215,12 +215,16 @@ remap_ssa_name (tree name, copy_body_data *id)
> >>               processing_debug_stmt = -1;
> >>               return name;
> >>             }
> >> +         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);
> >>           SET_DECL_MODE (vexpr, DECL_MODE (SSA_NAME_VAR (name)));
> >>           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);
> >>           return vexpr;
> >>         }
> >>
> >>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]