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.