On Thu, Feb 08, 2024 at 10:37:14AM +0000, Tamar Christina wrote: > PR tree-optimization/113808 > * tree-vect-loop.cc (vectorizable_live_operation): Don't cache the > value cross iterations. > > gcc/testsuite/ChangeLog: > > PR tree-optimization/113808 > * gfortran.dg/vect/vect-early-break_1-PR113808.f90: New test.
Please use lowercase pr instead of PR for consistency with all the other tests in the directory. > --- inline copy of patch -- > diff --git a/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-PR113808.f90 > b/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-PR113808.f90 > new file mode 100644 > index > 0000000000000000000000000000000000000000..5c339fa7a348fac5527bbbf456a535da96b5c1ed > --- /dev/null > +++ b/gcc/testsuite/gfortran.dg/vect/vect-early-break_1-PR113808.f90 > @@ -0,0 +1,21 @@ > +! { dg-add-options vect_early_break } > +! { dg-require-effective-target vect_early_break } > +! { dg-require-effective-target vect_long_long } > +! { dg-additional-options "-fopenmp-simd" } > + > +! { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } > + > +program main > + integer :: n, i,k > + n = 11 > + do i = 1, n,2 > + !$omp simd lastprivate(k) Please either drop lastprivate(k) clause or use linear(k:1) The iteration var of simd loop without collapse or with collapse(1) is implicitly linear with the step, and even linear means the value from the last iteration can be used after the simd construct. Overriding the data sharing to something different has been only added recently to OpenMP and isn't really needed here. > + do k = 1, i + 41 > + if (k > 11 + 41 .or. k < 1) error stop > + end do > + end do > + if (k /= 53) then > + print *, k, 53 > + error stop > + endif > +end Jakub