public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Robin Dapp <rdapp.gcc@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	"richard.sandiford" <richard.sandiford@arm.com>
Subject: Re: [PATCH] fwprop: Allow UNARY_P and check register pressure.
Date: Mon, 28 Aug 2023 17:33:39 -0600	[thread overview]
Message-ID: <48bed106-190e-ab5f-4099-fdfd4f5a193f@gmail.com> (raw)
In-Reply-To: <9acc1a24-5d01-40ad-b4b2-5948585d3e8c@gmail.com>



On 8/24/23 08:06, Robin Dapp via Gcc-patches wrote:
> Ping.  I refined the code and some comments a bit and added a test
> case.
> 
> My question in general would still be:  Is this something we want
> given that we potentially move some of combine's work a bit towards
> the front of the RTL pipeline?
> 
> Regards
>   Robin
> 
> Subject: [PATCH] fwprop: Allow UNARY_P and check register pressure.
> 
> This patch enables the forwarding of UNARY_P sources.  As this
> involves potentially replacing a vector register with a scalar register
> the ira_hoist_pressure machinery is used to calculate the change in
> register pressure.  If the propagation would increase the pressure
> beyond the number of hard regs, we don't perform it.
> 
> gcc/ChangeLog:
> 
> 	* fwprop.cc (fwprop_propagation::profitable_p): Add unary
> 	handling.
> 	(fwprop_propagation::update_register_pressure): New function.
> 	(fwprop_propagation::register_pressure_high_p): New function
> 	(reg_single_def_for_src_p): Look through unary expressions.
> 	(try_fwprop_subst_pattern): Check register pressure.
> 	(forward_propagate_into): Call new function.
> 	(fwprop_init): Init register pressure.
> 	(fwprop_done): Clean up register pressure.
> 	(fwprop_insn): Add comment.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/rvv/autovec/binop/vadd-vx-fwprop.c: New test.
So I was hoping that Richard S. would chime in here as he knows this 
code better than anyone.

This looks like a much better implementation of something I've done 
before :-)  Basically imagine a target where a sign/zero extension can 
be folded into arithmetic for free.  We put in various hacks to this 
code to encourage more propagations of extensions.

I still think this is valuable.  As we lower from gimple->RTL we're 
going to still have artifacts in the RTL that we're going to want to 
optimize away.  fwprop has certain advantages over combine, including 
the fact that it runs earlier, pre-loop.


It looks generally sensible to me.  But give Richard S. another week to 
chime in.  He seems to be around, but may be slammed with stuff right now.

jeff


  reply	other threads:[~2023-08-28 23:33 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 [this message]
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

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=48bed106-190e-ab5f-4099-fdfd4f5a193f@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdapp.gcc@gmail.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).