public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Richard Sandiford <Richard.Sandiford@arm.com>
Cc: Wilco Dijkstra via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] AArch64: Improve address rematerialization costs
Date: Tue, 10 May 2022 14:57:07 +0000	[thread overview]
Message-ID: <DB6PR0801MB18790FEA5F78A2BA1044E26783C99@DB6PR0801MB1879.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <mpt8rraaa0o.fsf@arm.com>

Hi Richard,

>> There isn't really a better way of doing this within the existing costing code.
>
> Yeah, I was wondering whether we could change something there.
> ADRP+LDR is logically more expensive than a single LDR, especially
> when optimising for size, so I think it's reasonable for the rtx_costs
> to say so.  But that doesn't/shouldn't mean that spilling is better
> (for either size or speed).
>
> So it feels like there's something missing in the way the costs are
> being applied.

Calculating accurate spill costs is hard. Spill optimization is done later, so
until then you can't know the actual cost of a spill decision already made.
Spills are also more expensive than you think due to store latency, more
dirty cachelines etc. There is little benefit in lifting an ADRP to the start of
a function but keep ADD/LDR close to references. Basically ADRP/MOV are
very cheap, so it's a waste to allocate these to long-lived registers.

Given that there are significant codesize and performance improvements,
it is clear that doing more rematerialization is better even in cases where it
takes 2 instructions to recompute the address. Binaries show a significant
reduction in stack-based loads and stores.

Cheers,
Wilco


  reply	other threads:[~2022-05-10 14:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 16:11 Wilco Dijkstra
2022-05-09 16:27 ` Richard Sandiford
2022-05-09 17:18   ` Wilco Dijkstra
2022-05-09 17:30     ` Richard Sandiford
2022-05-10 14:57       ` Wilco Dijkstra [this message]
2022-05-10 15:19         ` Richard Sandiford
2022-05-11 11:13           ` Wilco Dijkstra
2022-05-11 12:22             ` Richard Sandiford
2022-05-11 13:08               ` Richard Biener
2022-05-12  8:21                 ` Richard Sandiford
2022-05-12 14:54                   ` Wilco Dijkstra
2022-05-12 16:00               ` Wilco Dijkstra
2022-05-12 17:20                 ` Richard Sandiford
  -- strict thread matches above, loose matches on Subject: below --
2021-06-02 10:21 Wilco Dijkstra
2021-06-02 15:55 ` Richard Earnshaw
2021-06-02 16:48   ` Wilco Dijkstra
2021-10-20 14:52 ` Wilco Dijkstra
2021-11-04 14:18   ` Wilco Dijkstra
2021-11-04 18:22     ` Richard Sandiford
2021-11-24 16:51       ` Wilco Dijkstra

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=DB6PR0801MB18790FEA5F78A2BA1044E26783C99@DB6PR0801MB1879.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=Richard.Sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).