diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-09-20 12:58:16 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-09-20 12:58:16 +0000 |
commit | 508a909eca536f7f6a60af9bd7ecea761bd2e8f1 (patch) | |
tree | 7a689b08a7547223d500131fe82abd0fef4ebbfc | |
parent | a599af84b2170d8d66385674ef59283ac7567beb (diff) | |
download | gcc-508a909eca536f7f6a60af9bd7ecea761bd2e8f1.zip gcc-508a909eca536f7f6a60af9bd7ecea761bd2e8f1.tar.gz gcc-508a909eca536f7f6a60af9bd7ecea761bd2e8f1.tar.bz2 |
Add missing alignment checks in epilogue loop vectorisation (PR 86877)
Epilogue loop vectorisation skips vect_enhance_data_refs_alignment
since it doesn't make sense to version or peel the epilogue loop
(that will already have happened for the main loop). But this means
that it also fails to check whether the accesses are suitably aligned
for the new vector subarch.
We don't seem to carry alignment information from the (potentially
peeled or versioned) main loop to the epilogue loop, which would be
good to fix at some point. I think we want this patch regardless,
since there's no guarantee that the alignment requirements are the
same for every subarch.
2018-09-20 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/86877
* tree-vect-loop.c (vect_analyze_loop_2): Call
vect_verify_datarefs_alignment.
gcc/testsuite/
PR tree-optimization/86877
* gfortran.dg/vect/vect-8-epilogue.F90: New test.
From-SVN: r264439
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/vect-8-epilogue.F90 | 6 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 21 |
4 files changed, 28 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 728799d..af5fddf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-09-20 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/86877 + * tree-vect-loop.c (vect_analyze_loop_2): Call + vect_verify_datarefs_alignment. + 2018-09-19 Marek Polacek <polacek@redhat.com> * doc/invoke.texi: Document -Wclass-conversion. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25f61d2..ade95db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-20 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/86877 + * gfortran.dg/vect/vect-8-epilogue.F90: New test. + 2018-09-19 Marek Polacek <polacek@redhat.com> * g++.dg/conversion/op4.C: Add dg-warning. diff --git a/gcc/testsuite/gfortran.dg/vect/vect-8-epilogue.F90 b/gcc/testsuite/gfortran.dg/vect/vect-8-epilogue.F90 new file mode 100644 index 0000000..2a09539 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/vect-8-epilogue.F90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! { dg-require-effective-target vect_double } +! { dg-additional-options "-finline-matmul-limit=0 --param vect-epilogues-nomask=1" } +! { dg-additional-options "-mstrict-align" { target { aarch64*-*-* } } } + +#include "vect-8.f90" diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 640b0b9..70e9157 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1979,20 +1979,21 @@ start_over: if (!ok) return false; - /* Do not invoke vect_enhance_data_refs_alignment for eplilogue - vectorization. */ + /* Do not invoke vect_enhance_data_refs_alignment for epilogue + vectorization, since we do not want to add extra peeling or + add versioning for alignment. */ if (!LOOP_VINFO_EPILOGUE_P (loop_vinfo)) - { /* This pass will decide on using loop versioning and/or loop peeling in order to enhance the alignment of data references in the loop. */ ok = vect_enhance_data_refs_alignment (loop_vinfo); - if (!ok) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "bad data alignment.\n"); - return false; - } + else + ok = vect_verify_datarefs_alignment (loop_vinfo); + if (!ok) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bad data alignment.\n"); + return false; } if (slp) |