public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Move NOP stripping in SCEV analysis
Date: Tue, 25 Oct 2022 11:15:09 +0200 (CEST)	[thread overview]
Message-ID: <20221025091509.A7EBC134CA@imap2.suse-dmz.suse.de> (raw)

The following moves a pair of STRIP_USELESS_TYPE_CONVERSIONS to
where it belongs and adds a comment on why we handle GENERIC
there at all.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	* tree-scalar-evolution.cc (follow_ssa_edge_expr): Move
	STRIP_USELESS_TYPE_CONVERSIONS to where it matters.
---
 gcc/tree-scalar-evolution.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc
index 9f30f78cb5d..8b927094324 100644
--- a/gcc/tree-scalar-evolution.cc
+++ b/gcc/tree-scalar-evolution.cc
@@ -1214,6 +1214,8 @@ tail_recurse:
     {
       code = TREE_CODE (expr);
       type = TREE_TYPE (expr);
+      /* Via follow_ssa_edge_inner_loop_phi we arrive here with the
+	 GENERIC scalar evolution of the inner loop.  */
       switch (code)
 	{
 	CASE_CONVERT:
@@ -1224,6 +1226,8 @@ tail_recurse:
 	case MINUS_EXPR:
 	  rhs0 = TREE_OPERAND (expr, 0);
 	  rhs1 = TREE_OPERAND (expr, 1);
+	  STRIP_USELESS_TYPE_CONVERSION (rhs0);
+	  STRIP_USELESS_TYPE_CONVERSION (rhs1);
 	  break;
 	default:
 	  rhs0 = expr;
@@ -1260,8 +1264,6 @@ tail_recurse:
     case PLUS_EXPR:
     case MINUS_EXPR:
       /* This case is under the form "rhs0 +- rhs1".  */
-      STRIP_USELESS_TYPE_CONVERSION (rhs0);
-      STRIP_USELESS_TYPE_CONVERSION (rhs1);
       if (TREE_CODE (rhs0) == SSA_NAME
 	  && (TREE_CODE (rhs1) != SSA_NAME || code == MINUS_EXPR))
 	{
-- 
2.35.3

                 reply	other threads:[~2022-10-25  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221025091509.A7EBC134CA@imap2.suse-dmz.suse.de \
    --to=rguenther@suse.de \
    --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).