From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2] Add new target hook: constant_ok_for_cprop_p
Date: Mon, 12 Sep 2022 04:34:22 -0600 [thread overview]
Message-ID: <597159c3-6e31-0f23-6600-b0afc71d866a@gmail.com> (raw)
In-Reply-To: <CAFiYyc2qwXRO09xdL67VqviJ1n0GiyP_XkVGB=uqVWOLVt+6nQ@mail.gmail.com>
On 9/12/22 01:35, Richard Biener via Gcc-patches wrote:
> On Sun, Sep 11, 2022 at 10:51 PM Takayuki 'January June' Suwa via
> Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>> Hi,
>>
>> Many RISC machines, as we know, have some restrictions on placing register-width constants in the source of load-immediate machine instructions, so the target must provide a solution for that in the machine description.
>>
>> A naive way would be to solve it early, ie. to replace with read constants pooled in memory when expanding to RTL.
>>
>> Alternatively, a more fancy approach would be to forgo placement in the constant pool until somewhere before the reload/LRA eg. the "split1" pass to give the optimization passes that involve immediates a chance to work.
>>
>> If we choose the latter, we can expect better results with RTL if-conversion, constant folding, etc., but it often propagates constants that are too large in size to resolve to a simple load-immediate instruction.
>>
>> This is because constant propagation has no way of telling about it, so this patch provides it.
> What does prevent other passes like fwprop, CSE and PRE from doing the
> same propagation? Can that be the solution for
> constant propagation as well?
I would think this should be driven by costing rather than a new hook.
I'm pretty sure we already use costing to determine some of this stuff
for CSE/PRE.
jeff
prev parent reply other threads:[~2022-09-12 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-11 11:48 Takayuki 'January June' Suwa
2022-09-12 7:35 ` Richard Biener
2022-09-12 10:34 ` Jeff Law [this message]
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=597159c3-6e31-0f23-6600-b0afc71d866a@gmail.com \
--to=jeffreyalaw@gmail.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).