http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58243

            Bug ID: 58243
           Summary: Suboptimal structure initialization with tree-sra
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hp at gcc dot gnu.org
                CC: jamborm at gcc dot gnu.org

Created attachment 30700
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30700&action=edit
Example C code to be compiled at -O2 with/without -fno-tree-sra

See the attached code, which initializes a structure 4 byte long and copies it
through the pointer parameter in various similar functions, except func0 which
does the same bitwise setting using unsigned int to act as a reference for the
generated code (assuming a specific structure layout).

All functions are functionally equivalent; all struct members are set to
constants, either implicitly or explicitly, at initialization or afterwards,
and should be compiled to the same code at -O2.  With tree-sra (default) that
does not happen: there's byte-wise setting for at least x86_64-linux,
armv5-linux-gnueabi and cris-* for some of the functions.  With -O2
-fno-tree-sra the same code is generated for all functions.  Observed for
x86_64-unknown-linux-gnu, armv5-linux-gnueabi and cris-elf at r201882.

(I thought there already was a PR for this but couldn't find any.)

Reply via email to