Target x86_64-linux Following simple test case: #define N 64 #define ALIGN // __attribute__((aligned(64))) int a[N] ALIGN; int b[N] ALIGN; main() { int i; for (i = 0; i < N; i++) a[i] = b[i] + 1; } If I leave the ALIGN commented out I get really horrible manual alignment prologue code like -O3 -mavx512f .cfi_startproc movl $a, %eax andl $63, %eax shrq $2, %rax negq %rax andl $15, %eax je .L7 movl b(%rip), %edi cmpl $1, %eax leal 1(%rdi), %edx movl %edx, a(%rip) je .L8 ... lots of repeats upto 63 With ALIGN it's a nice short perfectly vectorized loop. It seems the automatic alignment of global variables doesn't work anymore. I checked the increase_alignment/ipa_increase_alignment pass in tree-vectorize.c and both don't run because flag_section_anchors is 0 in the gate. I'm not fully sure what the flag means?
You need C++ or -fno-common. Common variables really can't have alignment increased by the compiler.
Ok fair enough.