[Bug tree-optimization/98335] [9/10/11/12 Regression] Poor code generation for partial struct initialization
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 11 17:59:53 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98335
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:251ea6dfbdb4448875e41081682bb3aa451b5729
commit r12-7616-g251ea6dfbdb4448875e41081682bb3aa451b5729
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Fri Mar 11 17:57:12 2022 +0000
PR tree-optimization/98335: New peephole2 xorl;movb -> movzbl
This patch is the backend piece of my proposed fix to PR tree-opt/98335,
to allow C++ partial struct initialization to be as efficient/optimized
as full struct initialization.
With the middle-end patch just posted to gcc-patches, the test case
in the PR compiles on x86_64-pc-linux-gnu with -O2 to:
xorl %eax, %eax
movb c(%rip), %al
ret
with this additional peephole2 (actually four peephole2s):
movzbl c(%rip), %eax
ret
2022-03-11 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR tree-optimization/98335
* config/i386/i386.md (peephole2): Eliminate redundant insv.
Combine movl followed by movb. Transform xorl followed by
a suitable movb or movw into the equivalent movz[bw]l.
gcc/testsuite/ChangeLog
PR tree-optimization/98335
* g++.target/i386/pr98335.C: New test case.
* gcc.target/i386/pr98335.c: New test case.
More information about the Gcc-bugs
mailing list