mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 06:49:09 +02:00
master
The TU from this PR exhibits a 40x compile-time slowdown with -freflection vs without, all due to consteval_only_p which happens to be quite slow on large intertwined classes due to its recursive walking of TYPE_FIELDS. This patch firstly rewrites the predicate to use direct recursion instead of cp_walk_tree so that it's easier to reason about and more closely mirrors its standard definition at [basic.types.general]/12. This patch also makes the recursive part of the predicate tri-state, where the third 'unknown' state corresponds to seeing an incomplete class type whose consteval-only-ness we don't yet know. Finally this patch caches the result of the predicate for class types when the result is known. When the result is unknown (due to an incomplete constituent type) then we don't cache so that a subsequent call to the predicate can try again. With this patch compile time for said TU is now 1.1x with -freflection instead of 40x. PR c++/125179 gcc/cp/ChangeLog: * reflect.cc: (consteval_only_type_r): Remove this cp_walk_tree callback and replace with ... (consteval_only_walker): ... this recursive memoized implementation. (consteval_only_p): Define in terms of consteval_only_walker. Reviewed-by: Jakub Jelinek <jakub@redhat.com> Reviewed-by: Jason Merrill <jason@redhat.com>
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
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
Languages
C++
30.7%
C
30.2%
Ada
14.4%
D
6.1%
Go
5.7%
Other
12.4%