https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88398
--- Comment #45 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
(In reply to Wilco from comment #44)
> (In reply to Jiu Fu Guo from comment #43)
> > To handle vectorization for this kind of code, it needs to overcome the hard
> > issue mentioned in comment #5: the loop has 2 exits.
>
> Yes and that also implies vector loads are unsafe unless they are
> non-faulting. Few ISAs have such support.
Thanks a lot for your kind comments!
For this case, the first match for (p[len] != cur[len]) very very possible
happen at middle of vector. Vector loading reads more data than required. Also
as comment #3 and comment #7 said, those data are in question if they are
really accessible.
Since this is a loop, can we assume it is safe if reading data less than the
upbound of the loop and if two buffers are not cross pages?
something like: "while (++len != max - sizeof(T)) { T a = *(T*)(p+len)..}" and
"p & page_size_mask == (p+len) & page_size_mask".