[Bug rtl-optimization/87871] [9 Regression] testcases fail after r265398 on arm

vmakarov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 12 20:07:00 GMT 2019


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

--- Comment #20 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Wilco from comment #19)
> (In reply to Peter Bergner from comment #18)
> > (In reply to Segher Boessenkool from comment #15)
> > >       Popping a5(r116,l0)  -- assign reg 3
> > >       Popping a3(r112,l0)  -- assign reg 4
> > >       Popping a2(r114,l0)  -- assign reg 3
> > >       Popping a0(r111,l0)  -- assign reg 0
> > >       Popping a4(r117,l0)  -- assign reg 0
> > >       Popping a1(r113,l0)  -- assign reg 2
> > > Assigning 4 to a5r116
> > > Disposition:
> > >     0:r111 l0     0    3:r112 l0     4    1:r113 l0     2    2:r114 l0     3
> > >     5:r116 l0     4    4:r117 l0     0
> > > 
> > > 
> > > r116 does not conflict with *any* other pseudo.  It is alive in the first
> > > two insns of the function, which are
> > 
> > So we initially assign r3 to r116 presumably because it has the same cost as
> > the other gprs and it occurs first in REG_ALLOC_ORDER.  Then
> > improve_allocation() decides that r4 is a better hard reg and switches the
> > assignment to that.  I'm not sure why it wouldn't choose r0 there instead.
> 
> I would expect that r116 has a strong preference for r0 given the r116 = mov
> r0 and thus allocating r116 to r0 should have the lowest cost by a large
> margin.

p116 conflicts with hr0.  Therefore it can not get hr0.  p112 is connected with
p116.  p112 got hr4 and p116 got 3.  Assigning 4 to 116 is profitable. 
Therefore assignment of p116 is changed to 4.

The question is why p116 conflicts with hr0.  Before RA we have

(insn 50 3 7 2 (set (reg:SI 116)
        (reg:SI 0 r0 [ a ]))
"/home/cygnus/vmakarov/build1/trunk/gcc/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c":11:1
181 {*arm_mo\
vsi_insn}
     (nil))

---> No reg-dead r0!

because later we have

call_insn 11 9 51 3 (parallel [
            (set (reg:SI 0 r0)
                (call (mem:SI (symbol_ref:SI ("foo") [flags 0x41] 
<function_decl 0x7f7cc85ac000 foo>) [0 foo S4 A32])
                    (const_int 0 [0])))
            (use (const_int 0 [0]))
            (clobber (reg:SI 14 lr))
        ])
"/home/cygnus/vmakarov/build1/trunk/gcc/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c":16:11
219 {*call_value_symbol}
     (expr_list:REG_CALL_DECL (symbol_ref:SI ("foo") [flags 0x41] 
<function_decl 0x7f7cc85ac000 foo>)
        (nil))
    (expr_list (clobber (reg:SI 12 ip))
        (expr_list:SI (use (reg:SI 0 r0))
            (nil))))

---> use r0!


More information about the Gcc-bugs mailing list