Martin Jambor e3a5cc3259
ipa-sra: Be optimistic about Fortran descriptors
Fortran descriptors are structures which are often constructed just
for a particular argument of a particular call where it is passed by
reference.  When the called function is under compiler's control, it
can be beneficial to split up the descriptor and pass it in individual
parameters.  Unfortunately, currently we allow IPA-SRA to replace a
pointer with a set of replacements which are at most twice as big in
total and for descriptors we'd need to bump that factor to seven.

This patch looks for parameters which are ADDR_EXPRs of local
variables which are written to and passed as arguments by reference
but are never loaded from and marks them with a flag in the call edge
summary.  The IPA analysis phase then identifies formal parameters
which are always fed such arguments and then is more lenient when it
comoes to size.

In order not to store to maximums per formal parameter, I calculate
the more lenient one by multiplying the existing one with a new
parameter.  If it is preferable to keep the maximums independent, we
can do that.  Documentation for the new parameter is missing as I
still need to re-base the patch on a version which has sphinx.  I will
write it before committing.

I have disable IPA-SRA in pr48636-2.f90 in order to be able to keep
using its dump-scan expressions.  The new testcase is basically a copy
of it with different options and IPA-SRA dump scans.

gcc/ChangeLog:

2022-11-11  Martin Jambor  <mjambor@suse.cz>

	* ipa-sra.cc (isra_param_desc): New field not_specially_constructed.
	(struct isra_param_flow): New field constructed_for_calls.
	(isra_call_summary::dump): Dump the new flag.
	(loaded_decls): New variable.
	(dump_isra_param_descriptor): New parameter hints, dump
	not_specially_constructed if it is true.
	(dump_isra_param_descriptors): New parameter hints, pass it to
	dump_isra_param_descriptor.
	(ipa_sra_function_summaries::duplicate): Duplicate new flag.
	(create_parameter_descriptors): Adjust comment.
	(get_gensum_param_desc): Bail out when decl2desc is NULL.
	(scan_expr_access): Add loaded local variables to loaded_decls.
	(scan_function): Survive if final_bbs is NULL.
	(isra_analyze_call): Compute constructed_for_calls flag.
	(process_scan_results): Be optimistic about size limits.  Do not dump
	computed param hints when dumpint IPA-SRA structures.
	(isra_write_edge_summary): Stream constructed_for_calls.
	(isra_read_edge_summary): Likewise.
	(ipa_sra_dump_all_summaries): New parameter hints, pass it to
	dump_isra_param_descriptor.
	(flip_all_hints_pessimistic): New function.
	(flip_all_param_hints_pessimistic): Likewise.
	(propagate_param_hints): Likewise.
	(disable_unavailable_parameters): Renamed to
	adjust_parameter_descriptions.  Expand size limits for parameters
	which are specially contstructed by all callers.  Check limits again.p
	(ipa_sra_analysis): Pass required hints to ipa_sra_dump_all_summaries.
	Add hint propagation.
	(ipa_sra_summarize_function): Initialize and destory loaded_decls,
	rearrange so that scan_function is called even when there are no
	candidates.
	* params.opt (ipa-sra-ptrwrap-growth-factor): New parameter.

gcc/testsuite/ChangeLog:

2021-11-11  Martin Jambor  <mjambor@suse.cz>

	* gfortran.dg/pr48636-2.f90: Disable IPA-SRA.
	* gfortran.dg/ipa-sra-1.f90: New test.
2022-12-14 00:58:24 +01:00
2022-12-13 00:18:07 +00:00
2022-12-08 00:17:45 +00:00
2022-12-11 00:17:43 +00:00
2022-12-08 00:17:45 +00:00
2022-12-09 00:18:54 +00:00
2022-12-12 14:18:14 -08:00
2022-12-11 00:17:43 +00:00
2022-12-12 00:22:21 +00:00
2022-12-01 00:17:51 +00:00
2022-12-10 00:17:39 +00:00
2022-12-09 11:08:55 +01:00

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.
Description
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%