Code bloat due to silly IRA cost model?

Segher Boessenkool
Wed Dec 18 15:29:00 GMT 2019

Hi Richard,

On Fri, Dec 13, 2019 at 10:31:54PM +0000, Richard Sandiford wrote:
> >> I didn't say it was combine's fault that RA was bad.  I said it was
> >> combine's fault that we have two pseudos rather than one.

See below.

> My point was the extra pseudo<-pseudo2 move is created by combine for
> its own internal purposes

And my point is that it is *not* internal purposes :-)  This is done
because we no longer combine with the hard register, but combining with
just a register move is quite beneficial for many targets.

We could (and probably should) do a 1->1 combine first, i.e. just
simplification for every single insn, but that causes other problems
right now.  GCC 11, I hope.

What happens is we have this:

insn_cost 4 for    14: r44:SF=r22:SF
      REG_DEAD r22:SF
insn_cost 4 for     2: r43:SF=r44:SF
      REG_DEAD r44:SF
insn_cost 4 for     6: r22:SF=r43:SF
      REG_DEAD r43:SF
insn_cost 0 for     7: r22:SF=call [`g'] argc:0
      REG_CALL_DECL `g'

(where insn 14 and r44 are created by make_more_copies).

Now, insn 14 would normally be combined into insn 2.  But this doesn't
happen because the target prohibits it, with the
targetm.class_likely_spilled_p in cant_combine_insn_p.

I wonder if we still need that at all?


More information about the Gcc mailing list