SLP vectorize not working

Hi, I am a newbie in LLVM-Project. I am testing the auto-vectorization in clang. I know that vectorization is default with -O2 or up, but I want to know how this work, especially slp-vectorize. Following the example on llvm website, I wrote the code and compiled it, but it seems to fail on vectorization.

void vadd(int* __restrict a, int* __restrict b, int n)
a[0] += b[0];
a[1] += b[1];
a[2] += b[2];
a[3] += b[3];



I used the following commands.

clang-16 --target=riscv64 -march=rv64gv -static -fsave-optimization-record -S -emit-llvm -O1 -fslp-vectorize Vadd.c -o Vadd.ll -Rpass-analysis=slp-vectorize
clang-16 --target=riscv64 -march=rv64gv -static -fsave-optimization-record -S -emit-llvm -O2 Vadd.c -o Vadd.ll -Rpass-analysis=slp-vectorize

But they fail in vectorization.
If you can answer my question, I would really appreciate it.

Thanks in advance!!

It looks like it is vectorizing
check this example

if you are relying on -Rpass-analysis to report the vectorization I think it doesn’t report it.

What does (trunk) means?

When I switch to clang 16.0.0, it change to scalar code.

SLP was disabled for RISCV in clang16

Thanks for your answer !
So which version of llvm should I use ?

It should be enabled in the 17.0.0 and in trunk