public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: Kyrill Tkachov <kyrylo.tkachov@arm.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	richard.sandiford@arm.com
Subject: Re: [PATCH][auto-inc-dec.c] Account for cost of move operation in FORM_PRE_ADD and FORM_POST_ADD cases
Date: Mon, 26 Oct 2015 11:14:00 -0000	[thread overview]
Message-ID: <562E0AB4.7050809@redhat.com> (raw)
In-Reply-To: <562E030B.7090908@arm.com>


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?


Bernd

  reply	other threads:[~2015-10-26 11:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 10:41 Kyrill Tkachov
2015-10-26 11:14 ` Bernd Schmidt [this message]
2015-10-26 11:28   ` Bernd Schmidt
2015-10-26 11:55     ` Kyrill Tkachov
2015-10-28 17:26       ` Christophe Lyon
2015-10-28 17:47         ` Kyrill Tkachov
2015-10-29 15:54           ` Kyrill Tkachov
2015-10-26 12:26   ` Oleg Endo
2015-10-26 16:12   ` Richard Sandiford
2015-10-26 21:48     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562E0AB4.7050809@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).