This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][auto-inc-dec.c] Account for cost of move operation in FORM_PRE_ADD and FORM_POST_ADD cases
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Bernd Schmidt <bschmidt at redhat dot com>, Kyrill Tkachov <kyrylo dot tkachov at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, richard dot sandiford at arm dot com
- Date: Mon, 26 Oct 2015 21:17:31 +0900
- Subject: Re: [PATCH][auto-inc-dec.c] Account for cost of move operation in FORM_PRE_ADD and FORM_POST_ADD cases
- Authentication-results: sourceware.org; auth=none
- References: <562E030B dot 7090908 at arm dot com> <562E0AB4 dot 7050809 at redhat dot com>
On Mon, 2015-10-26 at 12:12 +0100, Bernd Schmidt wrote:
> On 10/26/2015 11:40 AM, Kyrill Tkachov wrote:
> > In the FORM_POST_ADD case the pass transforms:
> > *a
> > ...
> > b <- a + c
> >
> > into
> >
> > b <- a
> > ...
> > *(b += c) post
> >
> >
> > However, the code in attempt_change that compares the costs of the
> > before and after sequences
> > has an oversight. When calculating the cost of the new sequence it
> > doesn't take into account the cost of the
> > b <- a move. This patch fixes the calculation by calling seq_cost
> > on the
> > result of the emit_move_insn call
> > we do to emit that move.
>
> But isn't that balanced by the fact that it doesn't seem to take into
> account the gain of removing the inc_insn either? So I think this
> can't
> be right.
>
> > + new_mov_cost = seq_cost (mov_insn, speed);
> > + }
> > +
> > + new_cost = new_mem_cost + new_mov_cost;
>
> Here I'd just replace the first line with
> new_cost += seq_cost (...)
> and lose the extra variable.
>
> I seem to recall Richard had a rewrite of all the autoinc code. I
> wonder
> what happened to that?
BTW there's been another recent attempt at replacing auto-inc-dec with
a more generic addressing mode selection (AMS) pass. It tries to take
into account costs of individual addressing modes for each mem access
and also combinations of address register modifications and addressing
modes. The initial version is for SH only and still requires some work
before it can be merged into mainline. I hope that I can make it for
GCC 6...
Cheers,
Oleg