Re: [r17-1485 Regression] FAIL: g++.dg/vect/slp-pr98855.cc -std=c++26 scan-tree-dump slp1 "not vectorized: vectorization is not profitable" on Linux/x86_64

Zhongyao Chen via Gcc-regression <[email protected]> Sat, 13 Jun 2026 10:59:31 +0800
Newsgroups gmane.comp.gcc.regression,gmane.comp.gcc.patches
Message-ID <CAJ1nKGZuxs4cTDD97qX=RK3ys=VoYVt33X3tUGWr_vN733y3RQ@mail.gmail.com>
On Fri, Jun 12, 2026 at 2:49 PM Haochen Jiang <[email protected]> wrote:
>
> On Linux/x86_64,
>
> 9f8409f2e2c28f64bf6a584bc81afcae0f084785 is the first bad commit
> commit 9f8409f2e2c28f64bf6a584bc81afcae0f084785
> Author: Zhongyao Chen <[email protected]>
> Date:   Wed Jun 3 20:44:59 2026 +0800
>
>     vect: Avoid external fallback while operand swap retry is possible
>
> caused
>
> FAIL: g++.dg/vect/slp-pr98855.cc  -std=c++26  scan-tree-dump-not slp1 "vectorizing stmts using SLP"
> FAIL: g++.dg/vect/slp-pr98855.cc  -std=c++26  scan-tree-dump slp1 "not vectorized: vectorization is not profitable"
>
> with GCC configured with
>
> ../../gcc/configure --prefix=/export/users3/haochenj/src/gcc-bisect/master/master/r17-1485/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl --enable-libmpx x86_64-linux --disable-bootstrap
>
> To reproduce:
>
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="vect.exp=g++.dg/vect/slp-pr98855.cc --target_board='unix{-m64\ -march=cascadelake}'"
>
> (Please directly reply to this email for question about this report.)
> (If you met problems with cascadelake related, disabling AVX512F in command line might save that.)
> (However, please make sure that there is no potential problems with AVX512.)

I took a quick look at PR98855. The current FAIL does not look like
the original issue there.
The inner loop is still scalar, and it seems we only vectorize the
final store now.

So I suspect this is more about cost model, the estimated costs are close.
And I'm not sure which is really better, but from the asm, the scalar
version looks better, since it uses fewer instructions.

-- 
Regards,
Zhongyao