From: Richard Sandiford <richard.sandiford@arm.com>
To: Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Jeff Law <jeffreyalaw@gmail.com>, Robin Dapp <rdapp.gcc@gmail.com>
Subject: Re: [PATCH] fwprop: Allow UNARY_P and check register pressure.
Date: Tue, 26 Sep 2023 17:24:47 +0100 [thread overview]
Message-ID: <mptjzscyka8.fsf@arm.com> (raw)
In-Reply-To: <3f2b6571-4c47-3ea5-2932-4060e45a94ea@gmail.com> (Robin Dapp via Gcc-patches's message of "Thu, 7 Sep 2023 16:25:45 +0200")
Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Thanks for looking at it in detail.
>
>> Yeah, I think this is potentially a blocker for propagating A into B
>> when A is used elsewhere. Combine is able to combine A and B while
>> keeping A in parallel with the result. I think either fwprop would
>> need to try that too, or it would need to be restricted to cases where A
>> is only used in B.
>
> That seems a rather severe limitation and my original use case would
> not get optimized considerably anymore. The intention was to replace
> all uses (if register pressure allows). Of course the example is simple
> enough that a propagation is always useful if the costs allow it, so
> it might not be representative.
>
> I'm wondering if we could (my original misunderstanding) tentatively
> try to propagate into all uses of a definition and, when reaching
> a certain ratio, decide that it might be worth it, otherwise revert.
> Would be very crude though, and not driven by the actual problem we're
> trying to avoid.
>
>> I think the summary is:
>>
>> IMO, we have to be mindful that combine is still to run. We need to
>> avoid making equal-cost changes if the new form is more complex, or
>> otherwise likely to interfere with combine.
>
> I guess we don't have a good measure for complexity or "combinability"
> and even lower-cost changes could result in worse options later.
> Would it make sense to have a strict less-than cost policy for those
> more complex propagations? Or do you consider the approach in its
> current shape "hopeless", given the complications we discussed?
>
>> Alternatively, we could delay the optimisation until after combine
>> and have freer rein, since we're then just mopping up opportunities
>> that other passes left behind.
>>
>> A while back I was experimenting with a second combine pass. That was
>> the original motiviation for rtl-ssa. I never got chance to finish it
>> off though.
>
> This doesn't sound like something that would still materialize before
> the end of stage 1 :)
> Do you see any way of restricting the current approach to make it less
> intrusive and still worthwhile? Limiting to vec_duplicate might be
> much too arbitrary but would still help for my original example.
FWIW, I sent an RFC for a late-combine pass that might help:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631406.html
I think it'll need some tweaking for your use case, but hopefully
it's "just" a case of expanding the register pressure tests.
Thanks,
Richard
prev parent reply other threads:[~2023-09-26 16:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 10:26 Robin Dapp
2023-08-24 14:06 ` Robin Dapp
2023-08-28 23:33 ` Jeff Law
2023-08-29 11:40 ` Richard Sandiford
2023-09-05 6:53 ` Robin Dapp
2023-09-05 8:38 ` Richard Sandiford
2023-09-05 8:45 ` Robin Dapp
2023-09-06 11:22 ` Robin Dapp
2023-09-06 20:44 ` Richard Sandiford
2023-09-07 7:56 ` Robin Dapp
2023-09-07 13:42 ` Richard Sandiford
2023-09-07 14:25 ` Robin Dapp
2023-09-26 16:24 ` Richard Sandiford [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=mptjzscyka8.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=rdapp.gcc@gmail.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).