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

Vladimir Makarov <vmakarov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu.org

--- Comment #9 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #8)

Thanks for the investigation, Jeff.  Coalescing in IRA is done by register cost
propagation.  Unfortunately, p46 gets a hard register (12) first, then p53 is
processed and it gets reg 10 as p53 occurs in insn 14 involving reg 10.

  12: r10:SI=call [r70:SI] argc:0
      REG_CALL_DECL `random'
   14: {r53:SI=r10:SI&0xf;clobber psw:CC;}
      REG_DEAD r10:SI
      REG_UNUSED psw:CC

IRA has a propagation cost algorithm from pseudos (through chains of pseudos). 
This approach was observed as working better than different explicit coalescing
algorithms, especially when we have irregular register files and when we are
using dynamic register classes in IRA.  

The propagation algorithm takes conflicting pseudos costs (preferences) into
account too.  So it is pretty good algorithm.  Unfortunately, there is no
analogous mechanism for hard registers.  If IRA had it, it would propagate
preference of p53 (reg 10) to p46 before assigning a hard reg to p46.

  I am not sure that the PR will be fixed for GCC-5.0 but it would be a good
small project for RA to consider in future.

  Interesting that if p53 were processed first for assigning, we would not have
such problem.

Reply via email to