public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8347] find_base_value part
Date: Tue, 23 Jan 2024 07:08:56 +0000 (GMT)	[thread overview]
Message-ID: <20240123070856.0EDEC3858408@sourceware.org> (raw)

https://gcc.gnu.org/g:23ebb09ed2e88c1f292d4232c1fd2974cc5c79e6

commit r14-8347-g23ebb09ed2e88c1f292d4232c1fd2974cc5c79e6
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jan 15 13:09:48 2024 +0100

    find_base_value part
    
    The following adjusts find_base_value similar as to what
    find_base_term was adjusted for PR113255.
    
            * alias.cc (known_base_value_p): Remove.
            (find_base_value): Remove PLUS/MINUS handling
            when both operands are not CONST_INT_P.

Diff:
---
 gcc/alias.cc | 62 ++++--------------------------------------------------------
 1 file changed, 4 insertions(+), 58 deletions(-)

diff --git a/gcc/alias.cc b/gcc/alias.cc
index 6fad4b29d31..808e2095d9b 100644
--- a/gcc/alias.cc
+++ b/gcc/alias.cc
@@ -1400,26 +1400,6 @@ unique_base_value_p (rtx x)
   return GET_CODE (x) == ADDRESS && GET_MODE (x) == Pmode;
 }
 
-/* Return true if X is known to be a base value.  */
-
-static bool
-known_base_value_p (rtx x)
-{
-  switch (GET_CODE (x))
-    {
-    case LABEL_REF:
-    case SYMBOL_REF:
-      return true;
-
-    case ADDRESS:
-      /* Arguments may or may not be bases; we don't know for sure.  */
-      return GET_MODE (x) != VOIDmode;
-
-    default:
-      return false;
-    }
-}
-
 /* Inside SRC, the source of a SET, find a base address.  */
 
 static rtx
@@ -1490,46 +1470,12 @@ find_base_value (rtx src)
     case PLUS:
     case MINUS:
       {
-	rtx temp, src_0 = XEXP (src, 0), src_1 = XEXP (src, 1);
-
-	/* If either operand is a REG that is a known pointer, then it
-	   is the base.  */
-	if (REG_P (src_0) && REG_POINTER (src_0))
-	  return find_base_value (src_0);
-	if (REG_P (src_1) && REG_POINTER (src_1))
-	  return find_base_value (src_1);
-
-	/* If either operand is a REG, then see if we already have
-	   a known value for it.  */
-	if (REG_P (src_0))
-	  {
-	    temp = find_base_value (src_0);
-	    if (temp != 0)
-	      src_0 = temp;
-	  }
-
-	if (REG_P (src_1))
-	  {
-	    temp = find_base_value (src_1);
-	    if (temp!= 0)
-	      src_1 = temp;
-	  }
-
-	/* If either base is named object or a special address
-	   (like an argument or stack reference), then use it for the
-	   base term.  */
-	if (src_0 != 0 && known_base_value_p (src_0))
-	  return src_0;
-
-	if (src_1 != 0 && known_base_value_p (src_1))
-	  return src_1;
+	rtx src_0 = XEXP (src, 0), src_1 = XEXP (src, 1);
 
-	/* Guess which operand is the base address:
-	   If either operand is a symbol, then it is the base.  If
-	   either operand is a CONST_INT, then the other is the base.  */
-	if (CONST_INT_P (src_1) || CONSTANT_P (src_0))
+	/* If either operand is a CONST_INT, then the other is the base.  */
+	if (CONST_INT_P (src_1))
 	  return find_base_value (src_0);
-	else if (CONST_INT_P (src_0) || CONSTANT_P (src_1))
+	else if (CONST_INT_P (src_0))
 	  return find_base_value (src_1);
 
 	return 0;

                 reply	other threads:[~2024-01-23  7:08 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=20240123070856.0EDEC3858408@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@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).