Unshare DR_STEP before gimplifying it
authorRichard Sandiford <richard.sandiford@arm.com>
Sun, 29 Dec 2019 09:28:34 +0000 (09:28 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 29 Dec 2019 09:28:34 +0000 (09:28 +0000)
commitf0657516067909d688dc2424a876c1c894cbc182
tree1d475e6edb4ea3d64f91a2f0d8e0a152b4eeaf85
parent4bbd661e9937d46cc66182423f1946761a4f31c9
Unshare DR_STEP before gimplifying it

In this testcase we use an unmasked SVE loop with an Advanced SIMD
epilogue (because we don't yet support fully-masked downward loops).
The main loop uses a gather load for the strided access while the
epilogue loop builds the access from scalars instead.  In both cases
we gimplify expressions based on the DR_STEP and insert them in the
loop preheader.

The problem was that the gather load code didn't copy the DR_STEP before
gimplifying it, meaning that the epilogue loop tried to reuse a result
from the (non-dominating) main loop preheader.

It looks at first glance like there could be other instances of this too,
but this patch just deals with the gather/scatter case.

2019-12-29  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-stmts.c (vect_get_strided_load_store_ops): Copy
DR_STEP before gimplifying it.

gcc/testsuite/
* gcc.dg/vect/vect-strided-epilogue-1.c: New test.

From-SVN: r279753
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-strided-epilogue-1.c [new file with mode: 0644]
gcc/tree-vect-stmts.c