https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87223
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization, ra Target| |x86_64-*-* i?86-*-* Status|UNCONFIRMED |NEW Last reconfirmed| |2018-09-05 CC| |vmakarov at gcc dot gnu.org Component|c++ |target Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. I believe there are duplicates for this and I believe this optimization would be beneficial for -O2+ as well. Note that with -O2 we generate xorl %eax, %eax movb $0, (%rdi) movq $0, 8(%rdi) movw %ax, 16(%rdi) movq $0, 24(%rdi) ret the movw variant is generated by peephole2. I suppose LRA could be the place to "remat" constants.