public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>,
	Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org>,
	GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [COMMITTED] path solver: Solve PHI imports first for ranges.
Date: Fri, 12 Nov 2021 20:50:17 +0100	[thread overview]
Message-ID: <A408CAD8-9A30-4846-BF97-EF9068518111@gmail.com> (raw)
In-Reply-To: <20211112194625.1021072-1-aldyh@redhat.com>

On November 12, 2021 8:46:25 PM GMT+01:00, Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>PHIs must be resolved first while solving ranges in a block,
>regardless of where they appear in the import bitmap.  We went through
>a similar exercise for the relational code, but missed these.

Must not all stmts be resolved in program order (for optimality at least)? 

>Tested on x86-64 & ppc64le Linux.
>
>gcc/ChangeLog:
>
>	PR tree-optimization/103202
>	* gimple-range-path.cc
>	(path_range_query::compute_ranges_in_block): Solve PHI imports first.
>---
> gcc/gimple-range-path.cc | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
>diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
>index b9aceaf2565..71b290434cb 100644
>--- a/gcc/gimple-range-path.cc
>+++ b/gcc/gimple-range-path.cc
>@@ -365,12 +365,23 @@ path_range_query::compute_ranges_in_block (basic_block bb)
> 	clear_cache (name);
>     }
> 
>-  // Solve imports defined in this block.
>+  // Solve imports defined in this block, starting with the PHIs...
>+  for (gphi_iterator iter = gsi_start_phis (bb); !gsi_end_p (iter);
>+       gsi_next (&iter))
>+    {
>+      gphi *phi = iter.phi ();
>+      tree name = gimple_phi_result (phi);
>+
>+      if (import_p (name) && range_defined_in_block (r, name, bb))
>+	set_cache (r, name);
>+    }
>+  // ...and then the rest of the imports.
>   EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi)
>     {
>       tree name = ssa_name (i);
> 
>-      if (range_defined_in_block (r, name, bb))
>+      if (gimple_code (SSA_NAME_DEF_STMT (name)) != GIMPLE_PHI
>+	  && range_defined_in_block (r, name, bb))
> 	set_cache (r, name);
>     }
> 


  reply	other threads:[~2021-11-12 19:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 19:46 Aldy Hernandez
2021-11-12 19:50 ` Richard Biener [this message]
2021-11-12 20:03   ` Aldy Hernandez
2021-11-13  0:51   ` Andrew MacLeod
2021-11-13  9:41     ` Aldy Hernandez
2021-11-13 11:55       ` Aldy Hernandez
2021-11-13 13:43         ` Aldy Hernandez
2021-11-13 13:26       ` Richard Biener
2021-11-13 13:43         ` Aldy Hernandez

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=A408CAD8-9A30-4846-BF97-EF9068518111@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.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).