On Tue, Jan 08, 2019 at 01:40:41PM +0100, Martin Liška wrote: > As seen in the PR, when doing switch convert linear transformation, > one needs to first convert to unsigned type for constructor values. > > Patch survives regression tests and bootstrap on x86_64-linux-gnu. > Ready for trunk? > Thanks, > Martin > > > gcc/ChangeLog: > > 2019-01-08 Martin Liska <mli...@suse.cz> > > PR tree-optimization/88753 > * tree-switch-conversion.c (switch_conversion::build_one_array): > Come up with local variable constructor. Convert first to > type of constructor values.
Why is the testcase missing? Otherwise LGTM. Also, note contains_linear_function_p wide_int range_min = wi::to_wide (fold_convert (TREE_TYPE (elt0), m_range_min)); could be written on wide_ints directly: wide_int range_min = wide_int::from (wi::to_wide (m_range_min), TYPE_PRECISION (TREE_TYPE (elt0)), TYPE_SIGN (TREE_TYPE (m_range_min))); Jakub