On 10/11/18 3:03 PM, Jakub Jelinek wrote:
> On Thu, Oct 11, 2018 at 02:56:14PM +0200, Martin Liška wrote:
>> As seen in the PR, switch conversion can do better when we return equal
>> numbers
>> based on index value. I implemented more than that, more precisely I support
>> all linear
>> transformation based on index value. It's the same what clang is capable of.
>
> Not a review, just a question, do you check for overflows while computing
> it? Or force the arithmetics to be performed in a type with defined
> overflow. It would be bad to introduced UB...
Very valid question. I hope as long as I calculate the linear function
values in wide_int (get via wi::to_wide (switch_element)), then it should
overflow in the same way as original tree type arithmetic. I have a test-case
with
overflow: gcc/testsuite/gcc.dg/tree-ssa/pr84436-4.c.
Do you have any {over,under)flowing test-cases that I should add to test-suite?
Martin
>
> Jakub
>