public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: Ajit Agarwal <aagarwa1@linux.ibm.com>,
	Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH v5] tree-ssa-sink: Improve code sinking pass
Date: Thu, 22 Jun 2023 21:14:58 -0500	[thread overview]
Message-ID: <54383306-2e13-da8c-b256-739f674e95a8@linux.ibm.com> (raw)
In-Reply-To: <126e8bb8-8adb-3942-3126-00b430d78a86@linux.ibm.com>

On 6/1/23 11:54 PM, Ajit Agarwal via Gcc-patches wrote:
> 
> 
> On 01/06/23 2:06 pm, Bernhard Reutner-Fischer wrote:
>> On 1 June 2023 09:20:08 CEST, Ajit Agarwal <aagarwa1@linux.ibm.com> wrote:
>>> Hello All:
>>>
>>> This patch improves code sinking pass to sink statements before call to reduce
>>> register pressure.
>>> Review comments are incorporated.
>>
>> Hi Ajit!
>>
>> I had two comments for v4 that you did not address in v5 or followed up.
>> thanks,
> 
> Which comments I didn't address. Please let me know.

I believe he's referring to these two comments:

  > +	  && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb))
  > +	{
  > +	  if (def_use_same_block (use))
  > +	    return best_bb;
  > +
  > +	  return new_best_bb;
  > +	}
  > +	return best_bb;
  > +    }
  >  

  Many returns.
  I'd have said
	  && !def_use_same_block (use)
	return new_best_bb;
      else
	return best_bb;

  and rephrase the comment above list of Things to consider accordingly.


I agree with Bernhard's comment that it could be rewritten to be clearer.
Although, the "else" isn't really required.  So Bernhard's version would
look like:

  if (new_best_bb
      && use
      && new_best_bb != best_bb
      && new_best_bb != early_bb
      && !is_gimple_call (stmt)
      && gsi_end_p (gsi_start_phis (new_best_bb))
      && gimple_bb (use) != early_bb
      && !is_gimple_call (use)
      && dominated_by_p (CDI_POST_DOMINATORS, new_best_bb, gimple_bb (use))
      && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb)
      && !def_use_same_block (use))
    return new_best_bb;
  else
    return best_bb;

...or just:

  if (new_best_bb
      && use
      && new_best_bb != best_bb
      && new_best_bb != early_bb
      && !is_gimple_call (stmt)
      && gsi_end_p (gsi_start_phis (new_best_bb))
      && gimple_bb (use) != early_bb
      && !is_gimple_call (use)
      && dominated_by_p (CDI_POST_DOMINATORS, new_best_bb, gimple_bb (use))
      && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb)
      && !def_use_same_block (use))
    return new_best_bb;

  return best_bb;


Either works.


Peter


  reply	other threads:[~2023-06-23  2:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  7:20 Ajit Agarwal
2023-06-01  8:36 ` Bernhard Reutner-Fischer
2023-06-02  4:54   ` Ajit Agarwal
2023-06-23  2:14     ` Peter Bergner [this message]
2023-06-23  7:49       ` Ajit Agarwal

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=54383306-2e13-da8c-b256-739f674e95a8@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=aagarwa1@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=rep.dot.nop@gmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.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).