On Fri, May 10, 2024 at 12:19:35PM +0200, Richard Biener wrote: > On Fri, May 10, 2024 at 11:06 AM Segher Boessenkool > <seg...@kernel.crashing.org> wrote: > > *All* code using a cost will have to be inspected and possibly adjusted > > if you decide to use a different value for "unknown" than what we have > > had for ages. All other cost functions interacting with this one, too. > > Btw, looking around pattern_cost is the only API documenting this special > value and the function after it using this function, insn_cost does the same > but > > int > insn_cost (rtx_insn *insn, bool speed) > { > if (targetm.insn_cost) > return targetm.insn_cost (insn, speed); > > and the target hook doesn't document this special value. set_src_cost > doesn't either, btw (that just uses rtx_cost). So I don't think how > pattern_cost handles the set_src_cost result is warranted. There's > simply no way to detect whether set_src_cost returns an actual > value - on the contrary, it always does.
I introduced insn_cost. I didn't think about documenting that 0 means unknown, precisely because that is so pervasive! Segher