if-to-switch: Support chain with 2 BBs.
authorMartin Liska <mliska@suse.cz>
Tue, 1 Dec 2020 11:18:46 +0000 (12:18 +0100)
committerMartin Liska <mliska@suse.cz>
Wed, 2 Dec 2020 07:18:18 +0000 (08:18 +0100)
commitc961e94901eb793b1a18d431a1acf7f682eaf04f
treec29fc24b169c2851cc98e6dab952e02a116fd681
parente4c02ce4ab6fce1148f4025360096f18764deadf
if-to-switch: Support chain with 2 BBs.

As seen in the test-case, even 2 BBs can handle interesting
cases covered by a jump table or a bit-test.

gcc/ChangeLog:

PR tree-optimization/88702
* gimple-if-to-switch.cc (pass_if_to_switch::execute):
Require at least 2 BBs.
* gimple-if-to-switch.cc (find_conditions): Require
equal precision for low and high of a range.

gcc/testsuite/ChangeLog:

PR tree-optimization/88702
* gcc.dg/tree-ssa/if-to-switch-9.c: New test.
gcc/gimple-if-to-switch.cc
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c [new file with mode: 0644]