1ece90ffa9
In spring I added code eliminating any statements using parameters removed by IPA passes (to fix PR 93385). That patch fixed issues such as divisions by zero that such code could perform but it only reset all affected debug bind statements, this one updates them with expressions which can allow the debugger to print the removed value - see the added test-case for an example. Even though I originally did not want to create DEBUG_EXPR_DECLs for intermediate values, I ended up doing so, because otherwise the code started creating statements like # DEBUG __aD.198693 => &MEM[(const struct _Alloc_nodeD.171110 *)D#195]._M_tD.184726->_M_implD.171154 which not only is a bit scary but also gimple-fold ICEs on it. Therefore I decided they are probably quite necessary. The patch simply notes each removed SSA name present in a debug statement and then works from it backwards, looking if it can reconstruct the expression it represents (which can fail if a non-degenerate PHI node is in the way). If it can, it populates two hash maps with those expressions so that 1) removed assignments are replaced with a debug bind defining a new intermediate debug_decl_expr and 2) existing debug binds that refer to SSA names that are bing removed now refer to corresponding debug_decl_exprs. If a removed parameter is passed to another function, the debugging information still cannot describe its value there - see the xfailed test in the testcase. I sort of know what needs to be done but that needs a little bit more of IPA infrastructure on top of this patch and so I would like to get this patch reviewed first. Bootstrapped and tested on x86_64-linux, i686-linux and (long time ago) on aarch64-linux. Also LTO-bootstrapped and on x86_64-linux. Perhaps it is good to go to trunk? Thanks, Martin gcc/ChangeLog: 2021-03-29 Martin Jambor <mjambor@suse.cz> PR ipa/93385 * ipa-param-manipulation.h (class ipa_param_body_adjustments): New members remap_with_debug_expressions, m_dead_ssa_debug_equiv, m_dead_stmt_debug_equiv and prepare_debug_expressions. Added parameter to mark_dead_statements. * ipa-param-manipulation.c: Include tree-phinodes.h and cfgexpand.h. (ipa_param_body_adjustments::mark_dead_statements): New parameter debugstack, push into it all SSA names used in debug statements, produce m_dead_ssa_debug_equiv mapping for the removed param. (replace_with_mapped_expr): New function. (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. (ipa_param_body_adjustments::prepare_debug_expressions): Likewise. (ipa_param_body_adjustments::common_initialization): Gather and procecc SSA which will be removed but are in debug statements. Simplify. (ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize new members. * tree-inline.c (remap_gimple_stmt): Create a debug bind when possible when avoiding a copy of an unnecessary statement. Remap removed SSA names in existing debug statements. (tree_function_versioning): Do not create DEBUG_EXPR_DECL for removed parameters if we have already done so. gcc/testsuite/ChangeLog: 2021-03-29 Martin Jambor <mjambor@suse.cz> PR ipa/93385 * gcc.dg/guality/ipa-sra-1.c: New test. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.