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

--- Comment #11 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
I consider it is a LRA bug.

We have

281: {r360:DI=~227:DI&[r363:SI+r362:SI];clobber flags:CC;}

and choose alternative "(0) &r  (1) r  (2) o"

LRA assigns (hr0,hr1) to spilled p227, then assigns (hr4,hr5) to spilled 360 by
spilling 363 and 362 (assigned to hr5 and h4 correspondingly) on the 1st
assignment subpass.

On the 2nd assignment subpass it assigns hr2 to spilled 363 (reload pseudo 443)
and hr4 to spilled 362 (reload pseudo 444) by spilling 360 again.  But LRA can
not assign a hard reg to pseudo 477 which is a reload pseudo of 360.

This alt requires 6 regs. But we have only 5 as sp is a fixed reg, bp is fixed
because of -fno-omit-frame-pointer, bx is assigned to pic_offset_table_pseudo
because of -fPIC.

Still we could spill or split pic_offset_table_pseudo to assign regs to all
insn pseudos.

But even if I'll fix the bug in LRA, I should say that the usage of the
alternative and analogous alternatives for other insns (when we have only 5
available regs) will produce a bad code with excessive reg shuffling.

So the alternative somehow should not be used for -fno-omit-frame-pointer and
-fPIC to avoid ineffective code generation.

In any case I'll try to fix this bug in LRA this week.
  • [Bug target/116587] [14/15 Regr... vmakarov at gcc dot gnu.org via Gcc-bugs

Reply via email to