Why does vectorization fail?
问题 I want to optimize my code for vectorization using -msse2 -ftree-vectorizer-verbose=2. I have the following simple code: int main(){ int a[2048], b[2048], c[2048]; int i; for (i=0; i<2048; i++){ b[i]=0; c[i]=0; } for (i=0; i<2048; i++){ a[i] = b[i] + c[i]; } return 0; } Why do I get the note test.cpp:10: note: not vectorized: not enough data-refs in basic block. Thanks! 回答1: For what it's worth, after adding an asm volatile("": "+m"(a), "+m"(b), "+m"(c)::"memory"); near the end of main , my