Skip to content
Snippets Groups Projects
Commit 0d5cc976 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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.
parent 45c8523d
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment