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] Fix handling of non-localized vars and remove_forwarder_block (PR debug/43329)


On Thu, Mar 11, 2010 at 1:23 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This patch fixes 2 issues:
>
> 1) When early inliner inlines some routine and remaps some vars, then later
> on they are optimized out and just referenced by DEBUG stmts (so var_ann is
> NULL), then normal inliner inlines this function into some other function,
> the variables are non-localized. ?If we don't want to introduce -g/-g0
> code generation differences, we can't do otherwise, unless we stop making
> such vars non-localized. ?The problem is that we store DECL_ORIGIN of the
> var into BLOCK_NONLOCALIZED_VARS, while debug stmts of course reference
> the variable that has been remapped during early inlining. ?This means
> that for many such variables we provide no DW_AT_location nor
> DW_AT_const_value, eventhough VTA and var-tracking actually computed its
> location. ?Fixed by remembering the current variable instead of its origin
> in BLOCK_NONLOCALIZED_VARS, and adjusting dwarf2out to cope with such a
> change.
>
> 2) On the larger testcase I've been wondering why min and this parameters
> don't have DEBUG stmts added, when the function is inlined with constant
> arguments. ?Turns out that they are created, but then during cfg cleanup
> they are discarded. ?Those 2 DEBUG stmts live in a basic block that
> cfg cleanup considers to be a forwarder block (it disregards debug stmts),
> and when removing this forwarder block the code wants to move over the debug
> stmts after labels of next bb if it has just a single predecessor.
> In this case it has just one, but as the single_pred_p test is done
> after moving in new incoming edges from the forwarder block, it fails.
> And after fixing it I've noticed that it moves/copies over just the first
> DEBUG stmt, but possibly many times, so the patch fixes that too.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux. ?Even in non-inline
> heavy code like cc1 the amount of vars with DW_AT_location attribute
> grew from ~ 260000 to ~ 320000. ?Ok for trunk?
>
> 2010-03-11 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR debug/43329
> ? ? ? ?* tree-inline.c (remap_decls): Put old_var rather than origin_var
> ? ? ? ?into *nonlocalized_list vector.
> ? ? ? ?* dwarf2out.c (gen_formal_parameter_die): Call decl_ultimate_origin
> ? ? ? ?even if origin is non-NULL.
> ? ? ? ?(gen_variable_die): Likewise.
> ? ? ? ?(process_scope_var): Don't change origin.
> ? ? ? ?(gen_decl_die): Likewise.
> ? ? ? ?* tree-cfgcleanup.c (remove_forwarder_block): Check single_pred_p
> ? ? ? ?before adding new edges instead of after it, fix moving over
> ? ? ? ?debug stmts.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46099


-- 
H.J.


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