On Wed, 29 Nov 2017, Jakub Jelinek wrote: > Hi! > > This PR complains that seq_cost counts all non-single_set insns as 1 > unconditionally, which is indeed bad. For some like compare + arithmetics > we even have now code in pattern_cost that handles those reasonably by > default, for others targets have the option through a hook to return > whatever they want. > > On the other side, IMNSHO we don't want to count CODE_LABELs, NOTEs, > BARRIERs, DEBUG_INSNs... > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Works for me. Thanks, Richard. > 2017-11-29 Jakub Jelinek <ja...@redhat.com> > > PR middle-end/80929 > * rtlanal.c (seq_cost): For non-single_set insns try to use insn_cost. > > --- gcc/rtlanal.c.jj 2017-10-27 14:16:39.000000000 +0200 > +++ gcc/rtlanal.c 2017-11-27 13:35:46.321509933 +0100 > @@ -5342,7 +5342,13 @@ seq_cost (const rtx_insn *seq, bool spee > if (set) > cost += set_rtx_cost (set, speed); > - else > - cost++; > + else if (NONDEBUG_INSN_P (seq)) > + { > + int this_cost = insn_cost (CONST_CAST_RTX_INSN (seq), speed); > + if (this_cost > 0) > + cost += this_cost; > + else > + cost++; > + } > } > > return cost; > > Jakub > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)