Use range info in split_constant_offset (PR 81635)
commit3ae129323d150621d216fbbcdeebf033ef82416f
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 1 Feb 2018 14:17:07 +0000 (1 14:17 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 1 Feb 2018 14:17:07 +0000 (1 14:17 +0000)
tree8f337d98834feaf4ab484aa6f606a11157bea238
parentd677263e6c6ce0b40ca791e97f7b2f4ab0718f03
Use range info in split_constant_offset (PR 81635)

This patch implements the original suggestion for fixing PR 81635:
use range info in split_constant_offset to see whether a conversion
of a wrapping type can be split.  The range info problem described in:

    https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01002.html

seems to have been fixed.

The patch is part 1.  There needs to be a follow-on patch to handle:

  for (unsigned int i = 0; i < n; i += 4)
    {
      ...[i + 2]...
      ...[i + 3]...

which the old SCEV test handles, but which the range check doesn't.
At the moment we record that the low two bits of "i" are clear,
but we still end up with a maximum range of 0xffffffff rather than
0xfffffffc.

2018-01-31  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR tree-optimization/81635
* tree-data-ref.c (split_constant_offset_1): For types that
wrap on overflow, try to use range info to prove that wrapping
cannot occur.

gcc/testsuite/
PR tree-optimization/81635
* gcc.dg/vect/bb-slp-pr81635-1.c: New test.
* gcc.dg/vect/bb-slp-pr81635-2.c: Likewise.

From-SVN: r257296
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c [new file with mode: 0644]
gcc/tree-data-ref.c