Go to file
Jan Hubicka 494bdadf28 Enable pure-const discovery in modref.
We newly can handle some extra cases, for example:

struct a {int a,b,c;};
__attribute__ ((noinline))
int init (struct a *a)
{
  a->a=1;
  a->b=2;
  a->c=3;
}
int const_fn ()
{
  struct a a;
  init (&a);
  return a.a + a.b + a.c;
}

Here pure/const stops on the fact that const_fn calls non-const init, while
modref knows that the memory it initializes is local to const_fn.

I ended up reordering passes so early modref is done after early pure-const
mostly to avoid need to change testsuite which greps for const functions
being detects in pure-const.  Stil some testuiste compensation is needed.

gcc/ChangeLog:

2021-11-11  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-modref.c (analyze_function): Do pure/const discovery, return
	true on success.
	(pass_modref::execute): If pure/const is discovered fixup cfg.
	(ignore_edge): Do not ignore pure/const edges.
	(modref_propagate_in_scc): Do pure/const discovery, return true if
	cdtor was promoted pure/const.
	(pass_ipa_modref::execute): If needed remove unreachable functions.
	* ipa-pure-const.c (warn_function_noreturn): Fix whitespace.
	(warn_function_cold): Likewise.
	(skip_function_for_local_pure_const): Move earlier.
	(ipa_make_function_const): Break out from ...
	(ipa_make_function_pure): Break out from ...
	(propagate_pure_const): ... here.
	(pass_local_pure_const::execute): Use it.
	* ipa-utils.h (ipa_make_function_const): Declare.
	(ipa_make_function_pure): Declare.
	* passes.def: Move early modref after pure-const.

gcc/testsuite/ChangeLog:

2021-11-11  Jan Hubicka  <hubicka@ucw.cz>

	* c-c++-common/tm/inline-asm.c: Disable pure-const.
	* g++.dg/ipa/modref-1.C: Update template.
	* gcc.dg/tree-ssa/modref-11.c: Disable pure-const.
	* gcc.dg/tree-ssa/modref-14.c: New test.
	* gcc.dg/tree-ssa/modref-8.c: Do not optimize sibling calls.
	* gfortran.dg/do_subscript_3.f90: Add -O0.
2021-11-11 18:14:45 +01:00
c++tools Daily bump. 2021-10-27 00:16:33 +00:00
config Daily bump. 2021-09-20 00:16:21 +00:00
contrib Daily bump. 2021-11-09 00:16:21 +00:00
fixincludes Daily bump. 2021-08-31 00:16:50 +00:00
gcc Enable pure-const discovery in modref. 2021-11-11 18:14:45 +01:00
gnattools Daily bump. 2021-10-23 00:16:26 +00:00
gotools Daily bump. 2021-09-22 00:16:28 +00:00
include Daily bump. 2021-11-06 00:16:24 +00:00
INSTALL
intl Daily bump. 2021-06-15 00:16:37 +00:00
libada Daily bump. 2021-10-23 00:16:26 +00:00
libatomic Daily bump. 2021-07-22 00:16:46 +00:00
libbacktrace Daily bump. 2021-10-23 00:16:26 +00:00
libcc1 Daily bump. 2021-08-18 00:16:48 +00:00
libcody Daily bump. 2021-11-02 00:16:32 +00:00
libcpp Daily bump. 2021-11-02 00:16:32 +00:00
libdecnumber Daily bump. 2021-10-23 00:16:26 +00:00
libffi Daily bump. 2021-11-05 00:16:36 +00:00
libgcc libgcc: Fix backtrace fallback on PowerPC Big-endian 2021-11-11 15:29:25 +00:00
libgfortran Daily bump. 2021-10-19 00:16:23 +00:00
libgo runtime: set runtime.GOROOT value at build time 2021-09-21 14:31:10 -07:00
libgomp Fortran/openmp: Add support for 2 argument num_teams clause 2021-11-11 17:27:00 +01:00
libiberty Daily bump. 2021-10-23 00:16:26 +00:00
libitm Daily bump. 2021-06-18 00:16:58 +00:00
libobjc
liboffloadmic Daily bump. 2021-10-20 00:16:43 +00:00
libphobos Daily bump. 2021-11-01 00:16:20 +00:00
libquadmath Daily bump. 2021-06-09 00:16:30 +00:00
libsanitizer libsanitizer: update LOCAL_PATCHES. 2021-11-05 18:21:42 +01:00
libssp
libstdc++-v3 Daily bump. 2021-11-11 00:16:28 +00:00
libvtv
lto-plugin Daily bump. 2021-09-14 00:16:23 +00:00
maintainer-scripts
zlib
.dir-locals.el dir-locals: Use https for bug references 2021-07-20 11:40:34 +01:00
.gitattributes
.gitignore Add cscope.out to git ignore. 2021-06-24 16:51:40 +05:30
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2021-11-04 00:16:32 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets 2021-10-28 10:42:49 -04:00
configure.ac [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets 2021-10-28 10:42:49 -04:00
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: Clarify the policy WRT the Write After Approval list 2021-11-03 17:05:48 +00:00
Makefile.def Add install-dvi Makefile targets. 2021-10-22 15:43:50 -07:00
Makefile.in [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets 2021-10-28 10:42:49 -04:00
Makefile.tpl [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets 2021-10-28 10:42:49 -04:00
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.