https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96344
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <ebotca...@gcc.gnu.org>: https://gcc.gnu.org/g:ffd961fc053419bc1eb37792c18ec98e7c3bc364 commit r11-5836-gffd961fc053419bc1eb37792c18ec98e7c3bc364 Author: Eric Botcazou <ebotca...@adacore.com> Date: Tue Dec 8 08:57:46 2020 +0100 PR tree-optimization/96344 The very recent addition of the if_to_switch pass has partially disabled the optimization added back in June to optimize_range_tests_to_bit_test, as witnessed by the 3 new failures in the gnat.dg testsuite. It turns out that both tree-ssa-reassoc.c and tree-switch-conversion.c can turn things into bit tests so the optimization is added to bit_test_cluster::emit too. The patch also contains a secondary optimization, whereby the full bit-test sequence is sent to the folder before being gimplified in case there is only one test, so that the optimal sequence (bt + jc on x86) can be emitted like with optimize_range_tests_to_bit_test. gcc/ChangeLog: PR tree-optimization/96344 * tree-switch-conversion.c (bit_test_cluster::emit): Compute the range only if an entry test is necessary. Merge the entry test in the bit test when possible. Use PREC local variable consistently. When there is only one test, do a single gimplification at the end.