Switch conversion: support any ax + b transformation (PR tree-optimization/84436).
authorMartin Liska <mliska@suse.cz>
Wed, 24 Oct 2018 13:52:21 +0000 (15:52 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 24 Oct 2018 13:52:21 +0000 (13:52 +0000)
commit767d455188bb578360d8330782b161471997e3c3
tree7fa5d72f6fda68e83fd4cf40a560a0509e1ef498
parentb5d0cdc9c899a6046c01c1e9e3f19bb5ca08e67f
Switch conversion: support any ax + b transformation (PR tree-optimization/84436).

2018-10-24  Martin Liska  <mliska@suse.cz>

PR tree-optimization/84436
* tree-switch-conversion.c (switch_conversion::contains_same_values_p):
Remove.
(switch_conversion::contains_linear_function_p): New.
(switch_conversion::build_one_array): Support linear
transformation on input.
* tree-switch-conversion.h (struct switch_conversion): Add
contains_linear_function_p declaration.
2018-10-24  Martin Liska  <mliska@suse.cz>

PR tree-optimization/84436
* gcc.dg/tree-ssa/pr84436-1.c: New test.
* gcc.dg/tree-ssa/pr84436-2.c: New test.
* gcc.dg/tree-ssa/pr84436-3.c: New test.
* gcc.dg/tree-ssa/pr84436-4.c: New test.
* gcc.dg/tree-ssa/pr84436-5.c: New test.

From-SVN: r265463
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr84436-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr84436-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr84436-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr84436-5.c [new file with mode: 0644]
gcc/tree-switch-conversion.c
gcc/tree-switch-conversion.h