https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127510

            Bug ID: 127510
           Summary: GCC is not able to vectorize "std::for_each_n" loop
                    taking on random access iterator with more than one
                    pointers.
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vekumar at gcc dot gnu.org
  Target Milestone: ---

Created attachment 65638
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65638&action=edit
vector iterator.

This test case is simulated from loop vectorization differences seen in
750.sealcrypto_r of new SPEC2026 benchmark, when comparing LLVM and gcc

reference:
https://godbolt.org/z/97b6qqqvP

with -O3 -march=znver6 

GCC see pointer Phis and bails out 
--snip--
iter.vect.cpp:67:71: missed: couldn't vectorize loop
iter.vect.cpp:86:44: missed: not vectorized: no vectype for stmt: _32 =
MEM[(const long unsigned int &)__first$a_47];
--snip-

LLVM seem to convert this to loop to counted loop and vectorize.

Reply via email to