Hi Nick,

On Wed, Mar 18, 2020 at 08:56:11PM -0400, Nicholas Krause wrote:
> I've not sure if I've misunderstanding something in the combine code but 
> in make_more_copies
> for combine.c this seems very odd:
> if (!(REG_P (dest) && !HARD_REGISTER_P (dest)))
>     continue;
> 
>     rtx src = SET_SRC (set);
>     if (!(REG_P (src) && HARD_REGISTER_P (src)))
>         continue;
> 
> Is there any good reason we are assuming the destination can't both be a 
> hard register or a regular code here?

The destionation should be a pseudo-register, and the source should be
a hard register.  If those are true, *then* we make a copy to a new
intermediate pseudo.

We do not want combine to move the hard register into other instructions
(that is the register allocator's job, and it does a much better job of
it, combine just does the greedy first-fit solution).  But, it turns out
that combining a register move with another instruction often is
beneficial (in effect just replacing that other instruction with a
better one).  make_more_copies makes a fresh new register copy to keep
the status quo for that (other parts of combine now disallow combining
a move from a hard register into other insns).


Segher

Reply via email to