![]() This patch adds a limit on the number of cases of a switch. When this limit is exceeded, switch lowering decides to use faster but less powerful algorithms. In particular this means that for finding bit tests switch lowering decides between the old dynamic programming O(n^2) algorithm and the new greedy algorithm that Andi Kleen recently added but then reverted due to PR117352. It also means that switch lowering may bail out on finding jump tables if the switch is too large (Btw it also may not bail! It can happen that the greedy algorithms finds some bit tests which then basically split the switch into multiple smaller switches and those may be small enough to fit under the limit.) The limit is implemented as --param switch-lower-slow-alg-max-cases. Exceeding the limit is reported through -Wdisabled-optimization. This patch fixes the issue with the greedy algorithm described in PR117352. The problem was incorrect usage of the is_beneficial() heuristic. gcc/ChangeLog: PR middle-end/117091 PR middle-end/117352 * doc/invoke.texi: Add switch-lower-slow-alg-max-cases. * params.opt: Add switch-lower-slow-alg-max-cases. * tree-switch-conversion.cc (jump_table_cluster::find_jump_tables): Note in a comment that we are looking for jump tables in case sequences delimited by the already found bit tests. (bit_test_cluster::find_bit_tests): Decide between find_bit_tests_fast() and find_bit_tests_slow(). (bit_test_cluster::find_bit_tests_fast): New function. (bit_test_cluster::find_bit_tests_slow): New function. (switch_decision_tree::analyze_switch_statement): Report exceeding the limit. * tree-switch-conversion.h: Add find_bit_tests_fast() and find_bit_tests_slow(). Co-Authored-By: Andi Kleen <ak@gcc.gnu.org> Signed-off-by: Filip Kastl <fkastl@suse.cz> |
||
---|---|---|
.forgejo | ||
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.b4-config | ||
.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 | ||
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.