![]() A large source of cache misses in satisfy_atom is caused by the identity of an (atom,args) pair within the satisfaction cache being determined by the entire set of supplied template arguments rather than by the subset of template arguments that the atom actually depends on. For instance, consider template <class T> concept range = range_v<T>; template <class U> void foo () requires range<U>; template <class U, class V> void bar () requires range<U>; The associated constraints of foo and bar are equivalent: they both consist of the atom range_v<T> (with mapping T -> U). But the sat_cache currently will never reuse a satisfaction value between the two atoms because foo has one template parameter and bar has two, and the satisfaction cache conservatively assumes that all template parameters of the constrained decl are relevant to a satisfaction value of one of its atoms. This patch eliminates this assumption and makes the sat_cache instead care about just the subset of args of an (atom,args) pair that is relevant to satisfaction. This patch additionally fixes a seemingly latent bug that was found when testing against range-v3. In the testcase concepts-decltype2.C below, during normalization of f's constraints we end up forming a TARGET_EXPR whose _SLOT has a DECL_CONTEXT that points to g instead of f because current_function_decl is not updated before we start normalizing. This patch fixes this accordingly, and also adds a sanity check to keep_template_parm to verify each found parameter has a valid index. With this patch, compile time and memory usage for the cmcstl2 test test/algorithm/set_symmetric_difference4.cpp drops from 8.5s/1.2GB to 3.5s/0.4GB. gcc/cp/ChangeLog: * constraint.cc (norm_info::norm_info): Initialize orig_decl. (norm_info::orig_decl): New data member. (normalize_atom): When caching an atom for the first time, compute a list of template parameters used in the targets of the parameter mapping and store it in the TREE_TYPE of the mapping. (get_normalized_constraints_from_decl): Set current_function_decl appropriately when normalizing. As an optimization, don't set up a push_nested_class_guard when decl has no constraints. (sat_hasher::hash): Use this list to hash only the template arguments that are relevant to the atom. (satisfy_atom): Use this list to compare only the template arguments that are relevant to the atom. * pt.c (keep_template_parm): Do a sanity check on the parameter's index when flag_checking. |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
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 | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.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.