Go to file
Martin Jambor 1e3312a25a
ICF&SRA: Make ICF and SRA agree on padding
PR 113359 shows that (at least with -fno-strict-aliasing) ICF can
unify two functions which copy an aggregate type of the same size but
then SRA, through its total scalarization, can copy the aggregate by
pieces, skipping paddding, but the padding was not the same in the two
original functions that ICF unified.

This patch enhances SRA with the ability to collect padding
information which then can be compared from within ICF.  Unfortunately
SRA uses OPTION_SET_P when determining its limits, so ICF needs to
switch cfuns at least once to figure it out too.

gcc/ChangeLog:

2024-03-27  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113359
	* ipa-icf-gimple.h (func_checker): New members
	safe_for_total_scalarization_p, m_total_scalarization_limit_known_p
	and m_total_scalarization_limit.
	(func_checker::func_checker): Initialize new member variables.
	* ipa-icf-gimple.cc: Include tree-sra.h.
	(func_checker::func_checker): Initialize new member variables.
	(func_checker::safe_for_total_scalarization_p): New function.
	(func_checker::compare_operand): Use the new function.
	* tree-sra.h (sra_get_max_scalarization_size): Declare.
	(sra_total_scalarization_would_copy_same_data_p): Likewise.
	* tree-sra.cc (prepare_iteration_over_array_elts): New function.
	(class sra_padding_collecting): New.
	(sra_padding_collecting::record_padding): Likewise.
	(scalarizable_type_p): Rename to totally_scalarizable_type_p.  Add
	ability to record padding when requested.
	(totally_scalarize_subtree): Split out gathering information necessary
	to iterate over array elements to prepare_iteration_over_array_elts.
	Fix errornous early exit.
	(analyze_all_variable_accesses): Adjust the call to
	totally_scalarizable_type_p.  Move determining of total scalariation
	size limit...
	(sra_get_max_scalarization_size): ...here.
	(check_ts_and_push_padding_to_vec): New function.
	(sra_total_scalarization_would_copy_same_data_p): Likewise.

gcc/testsuite/ChangeLog:

2024-03-27  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113359
	* gcc.dg/lto/pr113359-1_0.c: New.
	* gcc.dg/lto/pr113359-1_1.c: Likewise.
	* gcc.dg/lto/pr113359-2_0.c: Likewise.
	* gcc.dg/lto/pr113359-2_1.c: Likewise.
	* gcc.dg/lto/pr113359-3_0.c: Likewise.
	* gcc.dg/lto/pr113359-3_1.c: Likewise.
	* gcc.dg/lto/pr113359-4_0.c: Likewise.
	* gcc.dg/lto/pr113359-4_1.c: Likewise.
	* gcc.dg/lto/pr113359-5_0.c: Likewise.
	* gcc.dg/lto/pr113359-5_1.c: Likewise.
2024-04-08 18:54:21 +02:00
.github
c++tools
config
contrib Daily bump. 2024-04-08 12:15:19 +00:00
fixincludes
gcc ICF&SRA: Make ICF and SRA agree on padding 2024-04-08 18:54:21 +02:00
gnattools
gotools
include
INSTALL
libada
libatomic Daily bump. 2024-04-08 12:15:19 +00:00
libbacktrace
libcc1
libcody
libcpp
libdecnumber
libffi
libgcc Daily bump. 2024-04-05 00:16:44 +00:00
libgfortran Daily bump. 2024-04-08 12:15:19 +00:00
libgm2
libgo
libgomp Daily bump. 2024-04-08 12:15:19 +00:00
libgrust
libiberty
libitm
libobjc
libphobos Daily bump. 2024-04-08 12:15:19 +00:00
libquadmath Daily bump. 2024-04-04 00:16:38 +00:00
libsanitizer
libssp
libstdc++-v3 libstdc++: Use char for _Utf8_view if char8_t isn't available [PR114519] 2024-04-08 17:44:18 +01:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2024-04-05 00:16:44 +00:00
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 MAINTAINERS: Update my email address 2024-04-04 16:39:52 +02:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt
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.