On Tue, Jun 30, 2015 at 02:16:19PM +0930, Alan Modra wrote:
> On Mon, Jun 29, 2015 at 09:34:40AM -0500, Segher Boessenkool wrote:
> > On Mon, Jun 29, 2015 at 05:16:39PM +0930, Alan Modra wrote:
> > > Note that we already have insn_rtx_cost, and it returns a minimum cost
> > > for a SET, so register move insns get a cost of 1 insn.  However,
> > > despite insn_rtx_cost starting life in combine.c, even combine doesn't
> > > use it in all whole insn cases.  :-(
> > 
> > In what cases does it not?
> 
> Practically all of the occurrences of set_src_cost in combine.c can be
> called on whole insns.  By "whole insn" I mean of course the right
> hand side of a set, or a single set inside a parallel.  I'm not saying
> that this causes trouble, since I haven't seen a register move there
> (but I haven't looked very hard either).

All (all five) places in combine where it uses set_src_cost it is
comparing two possible simplifications, to see if they are
simplifications at all.  So all is good as far as I see -- certainly
simplifying anything to just a register is the best you can do, so a
cost of 0 for that is fine.

For all instructions (including those that are not single sets) combine
uses insn_rtx_cost to decide the cost of the whole instructions, to see
if the final instruction combination it came up with is profitable.

insn_rtx_cost could certainly use some improvement though :-/


Segher

Reply via email to