[Bug rtl-optimization/70892] additional memory access generated in loop if destructor is inlined

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 27 18:34:32 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |rtl-optimization
      Known to fail|                            |9.1.0
           Keywords|                            |missed-optimization, ra
           Severity|normal                      |enhancement
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-27
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the different comes from sum having to be alive across eh edges.
GCC would spill the register to the stack before GCC 9.  In GCC 10+, it uses a
register.

Still not the best code:
.L6:
        movq    %r12, %xmm1
        addsd   (%rax), %xmm1
        addq    $8, %rax
        movq    %xmm1, %r12
        cmpq    %rax, %rdx
        jne     .L6

But no longer spills to the stack inside the loop.


More information about the Gcc-bugs mailing list