This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR47801, fold references in debug stmts
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Alexandre Oliva <aoliva at redhat dot com>
- Date: Sat, 19 Feb 2011 21:47:33 +0100
- Subject: Re: [PATCH] Fix PR47801, fold references in debug stmts
- References: <alpine.LNX.2.00.1102192129160.17230@zhemvz.fhfr.qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, Feb 19, 2011 at 09:32:05PM +0100, Richard Guenther wrote:
> With -fwhole-program we can see a lot of guality fails because we
> take global vars local and optimize them away only after we generate
> uses of it in debug statements. As debug statements are never
> folded we end up throwing away the debug information because we
> can't represent references to the optimized out decls. This also
> happens when guality is run with LTO and the linker plugin enabled.
>
> This makes us fold references in debug stmts at expansion time.
>
> Bootstrap and regtest on x86_64-unknown-linux-gnu running.
>
> Does this look ok?
I'd say this is done in a wrong spot, because if gimple_debug_bind_get_value
is say PLUS_EXPR of a VAR_DECL and INTEGER_CST, you wouldn't fold the
VAR_DECL.
Can't this be done at the beginning of expand_debug_expr instead (in the
switch based on TREE_CODE_CLASS you'd for
case tcc_declaration:
case tcc_reference:
do this folding and if you decide to use the folded value, you'd just
return expand_debug_expr (folded);
Jakub