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];
return;
}
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!!