[Bug target/86771] [9 Regression] gfortran.dg/actual_array_constructor_1.f90 fails on arm after combine 2 insns to 2 insns patch

segher at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 21 21:16:00 GMT 2018


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

--- Comment #20 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Wilco from comment #19)
> Well insn_cost() uses COSTS_N_INSNS (1) for instructions with unknown (zero)
> costs. That's a reasonable default and gives more accurate cost comparisons,
> eg. 0 + 4 vs 0 + 8 now becomes 4 + 4 vs 4 + 8.

You're talking about the default insn_cost, which uses pattern_cost to do the
work; pattern_cost returns COSTS_N_INSNS (1) if there is a single SET (or a
single SET and a single SET of COMPARE), and set_src_cost of that SET says it
is cost 0.  It does not say cost 0 for a PARALLEL of two SETs, like you have
here.

A target-specific insn_cost can return a saner cost for all insns, including
for those that are a "real" PARALLEL.

(COSTS_N_INSNS (1) isn't minimal of course, it is 4 like you already point
out; it is the default insn cost).

It never is clear that 0+4 is better than 0+8, because the 0's usually are not
the cost of the same insn.

> With those changes I think there will be far fewer cases with unknown costs.

I'm not sure what changes you propose.

> There will be cases where target insn_cost needs to be improved to more
> accurately model complex instructions, but that will result in even better
> code.

The arm port does not _have_ the insn_cost hook implemented; doing that will
probably help, sure.


More information about the Gcc-bugs mailing list