Auto-vectorization command flag not work in clang-13

Hi:
I want to use clang auto-vectorization for this code:


#include <stdio.h>

#include <stdint.h>

void test() {

int a[100];

for (int64_t i = 0; i < 100; i++) {

a[i] = i / 8;

}

printf("%ld %ld", a[0], a[99]);

}

int main(int argc, char** argv) {

test();

}

It worked with this command: clang -S -O3 vector_divide.c and it can get successfully vectorized asm.
But i want to use auto-vectorization as below:
clang -S -emit-llvm -mllvm -force-vector-width=8 vector_divide.c -o vec_dev.ll
opt -loop-vectorize -force-vector-width=8 -S vec_dev.ll -o vec_opt_dev.ll
clang -S vec_opt_dev.ll
Then it can’t worked, what should i do?
yours, zhengxianli

Hi,