This example says me that it doesn't. $ cat t2.c int a[2]; int b[2]; int main () { b[0] = a[0]; b[1] = a[1]; return 0; } $ gcc t2.c -O3 -S $ cat t2.s ... main: .LFB0: .cfi_startproc movl a(%rip), %eax movl %eax, b(%rip) movl a+4(%rip), %eax movl %eax, b+4(%rip) xorl %eax, %eax ret .cfi_endproc gcc version is: commit 71464ecd3a554b889c3bbc53d8874fc532bdf953 Author: trippels <trippels@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Mon Jan 12 07:53:10 2015 +0000
See bug 23684.
I think this has been discussed on the gcc mailing list.
> I think this has been discussed on the gcc mailing list Marek could you please share some resuting conclusion at least for x86 platform? Why didn't x86 GCC RTL fold these loads/stores?