[Bug middle-end/53535] New: non-aligned memset on non-strict-alignment targets not optimized where aligned memset is

hp at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 31 04:30:00 GMT 2012


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

             Bug #: 53535
           Summary: non-aligned memset on non-strict-alignment targets not
                    optimized where aligned memset is
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hp@gcc.gnu.org
            Target: x86_64-linux


The attached code is a modified gcc.dg/pr46647.c, which shows that memset isn't
optimized on unaligned short (int-sized) data as it is for aligned data, even
for non-strict-alignment targets, such as cris-* and x86_64-linux. Observe the
emitted assembly code, which uses the same instructions for aligned and
unaligned code as later optimizations cover up (for both cris-* and
x86_64-linux). Hence, I guess this bug isn't really that important when it
comes to just the generated code, just an annoying middle-end miss and
annoyingly failing test-case.  (Whether the over-alignment-checks misses other
optimization opportunities is another issue.)

Background: I stumbled upon this when changing the CRIS port to align global
data by default. This made the always-before-failing gcc.dg/pr46647.c pass, for
no good reason: alignment of data should not make a difference for emitted code
(except for atomic support, WIP for CRIS).

This may be related to PR 52861.



More information about the Gcc-bugs mailing list