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 PR47801, fold references in debug stmts


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


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