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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
           Keywords|needs-bisection             |
            Summary|[12 Regression] Failure to  |[12 Regression] Failure to
                   |use registers optimally     |use registers optimally
                   |with return values (2       |with return values (2
                   |operands related)           |operands related and
                   |                            |subreg)

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference in the IR happens from forwprop.
before RA we have this for the old compiler:
(insn 9 8 14 2 (set (reg:V8HI 89)
        (plus:V8HI (reg:V8HI 90)
            (subreg:V8HI (reg:V2DI 91) 0))) "/app/example.cpp":8:29 3418
{*addv8hi3}
     (expr_list:REG_DEAD (reg:V2DI 91)
        (expr_list:REG_DEAD (reg:V8HI 90)
            (nil))))
(insn 14 9 15 2 (set (reg/i:V2DI 20 xmm0)
        (subreg:V2DI (reg:V8HI 89) 0)) "/app/example.cpp":9:1 1439
{movv2di_internal}
     (expr_list:REG_DEAD (reg:V8HI 89)
        (nil)))

With the new compile we have:
(insn 10 9 14 2 (set (subreg:V8HI (reg:V2DI 84 [ <retval> ]) 0)
        (plus:V8HI (reg:V8HI 90)
            (subreg:V8HI (reg:V2DI 91) 0))) "/app/example.cpp":8:41 5787
{*addv8hi3}
     (expr_list:REG_DEAD (reg:V8HI 90)
        (expr_list:REG_DEAD (reg:V2DI 91)
            (nil))))
(insn 14 10 15 2 (set (reg/i:V2DI 20 xmm0)
        (reg:V2DI 84 [ <retval> ])) "/app/example.cpp":9:1 1634
{movv2di_internal}
     (expr_list:REG_DEAD (reg:V2DI 84 [ <retval> ])
        (nil)))

This now confuses the register allocator.

So this is only an issue with return because of the hard register being
involved. So this is a minor issue and not much of a problem unless you are
doing microbenchmarking.

Reply via email to