unswitch: Fold case label lo/hi values to index type [PR105770]
The following testcase ICEs because we use different types in comparison,
idx has int type, while CASE_LOW has char type.
While I believe all CASE_{LOW,HIGH} in the same switch have to use the same
or compatible type, the index expression can have a promoted type as happens
in this testcase. Other spots that handle switches do such foldings too.
2022-06-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/105770
* tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb): Cast
CASE_LOW and CASE_HIGH to TREE_TYPE (idx) before comparisons with idx.
* gcc.dg/pr105770.c: New test.