http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60086
--- Comment #8 from Marcin Krotkiewski <marcin.krotkiewski at gmail dot com> --- (In reply to Andrey Belevantsev from comment #5) > At this point insn 461 is dead but we do not notice, and it doesn't look > easy. I think there was some suggestion in the original research for > killing dead insn copies left after renaming but I don't remember offhand. Following Alexanders suggestion, I compiled the test code with -mavx -O3 -fselective-scheduling2 -frename-registers. This seems to get rid of the dead instructions and yields the desired scheduling: .L5: vmovapd (%rbx,%rdi), %ymm0 addq $1, %rsi vmovapd (%r12,%rdi), %ymm3 vaddpd 0(%r13,%rdi), %ymm0, %ymm2 vaddpd (%r14,%rdi), %ymm3, %ymm4 vmovapd %ymm2, (%rbx,%rdi) vmovapd %ymm4, (%r12,%rdi) addq $32, %rdi cmpq %rsi, %rdx ja .L5 Alexander, I should maybe clarify that the 'good' code was prepared by hand, modifying the 'bad' asm I got from gcc 4.7. Asm generated by gcc 4.4 was the same. If that is what you were refering to. I am a bit confused now. It seems that all fine and the desired asm can be generated, so there is no real bug. But why is the original code compiled with -O3 -mavx bad then? Is -fschedule-insns not enabled at -O2?