https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111630

            Bug ID: 111630
           Summary: Optimizing for size compiles additions to several
                    instructions
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christiandohn.rask at st dot com
  Target Milestone: ---

Compiled example where version, options, compiler outputs etc. are specified:
https://godbolt.org/z/6q9P33qf3

We are upgrading from ARM GCC 7.3.0 to 12.3.0 and are experiencing slower code
with the same options.

When adding offsets to pointers inside a loop, GCC 7.3.0 simply identifies this
a two add instructions (section .L3 in the assembly). The same code with GCC
12.3.0 (and back until at least 9.2.1) creates quite a few instructions in the
same section.

The issue only seems to appear when -Os is selected. Choosing e.g. -O2 results
in simpler assembly with additions.

Reply via email to