[Bug debug/54971] SRA pessimizes debug info by not creating debug stmts for fields without replacements

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 22 16:19:00 GMT 2012


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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-22 16:19:18 UTC ---
Created attachment 28510
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28510
gcc48-pr54971-incremental.patch

Incremental patch that makes the pr46571.c testcase pass.
The primary problem was passing non-NULL prefix to create_tmp_var* for
something
that is called solely if MAY_HAVE_DEBUG_STMTS, because create_tmp_var_name
uses a global counter for all temp variables, thus if it is incremented with -g
and not with -g0, it resulted e.g. in ivopts creating different var names,
which, unlike DECL_UIDs, should be the same.

I guess the SR.<NUM> names are still useful for debugging of SRA and later
passes (in the unlikely case where a fancy name isn't assigned, if there is
fancy name, there is no point in creating a SR.* name), but if we do that, it
is better to create it only for replacements used in non-debug code (which is
why I've moved the assignment of DECL_NAME if it doesn't have fancy name).
And I've moved also the dump_file printout, because otherwise it would be
confusing if we printed we've created a D.12345 replacement and subsequently
immediately used SR.123 for it's name instead.

I think we shouldn't be using create_tmp_var at all for the debug only
replacements, as it calls gimple_add_tmp_var and preferrably the local decls
should be the same between -g and -g0 too.



More information about the Gcc-bugs mailing list