public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-3619] Break out ao_ref_init_from_ptr_and_range from ao_ref_init_from_ptr_and_size
Date: Fri,  2 Oct 2020 11:15:14 +0000 (GMT)	[thread overview]
Message-ID: <20201002111514.80BCB384403D@sourceware.org> (raw)

https://gcc.gnu.org/g:b8e773e9921904210cad1f396b2ab01ffdbc4b39

commit r11-3619-gb8e773e9921904210cad1f396b2ab01ffdbc4b39
Author: Jan Hubicka <jh@suse.cz>
Date:   Fri Oct 2 13:14:57 2020 +0200

    Break out ao_ref_init_from_ptr_and_range from ao_ref_init_from_ptr_and_size
    
            * tree-ssa-alias.c (ao_ref_init_from_ptr_and_range): Break out from ...
            (ao_ref_init_from_ptr_and_size): ... here.

Diff:
---
 gcc/tree-ssa-alias.c | 52 ++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 12 deletions(-)

diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index fe390d4ffbe..9e5c3eee500 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -735,14 +735,21 @@ ao_ref_alias_set (ao_ref *ref)
 }
 
 /* Init an alias-oracle reference representation from a gimple pointer
-   PTR and a gimple size SIZE in bytes.  If SIZE is NULL_TREE then the
-   size is assumed to be unknown.  The access is assumed to be only
-   to or after of the pointer target, not before it.  */
+   PTR a range specified by OFFSET, SIZE and MAX_SIZE under the assumption
+   that RANGE_KNOWN is set.
 
-void
-ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
+   The access is assumed to be only to or after of the pointer target adjusted
+   by the offset, not before it (even in the case RANGE_KNOWN is false).  */
+
+static void
+ao_ref_init_from_ptr_and_range (ao_ref *ref, tree ptr,
+				bool range_known,
+				poly_int64 offset,
+				poly_int64 size,
+				poly_int64 max_size)
 {
-  poly_int64 t, size_hwi, extra_offset = 0;
+  poly_int64 t, extra_offset = 0;
+
   ref->ref = NULL_TREE;
   if (TREE_CODE (ptr) == SSA_NAME)
     {
@@ -766,7 +773,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
 	ref->offset = BITS_PER_UNIT * t;
       else
 	{
-	  size = NULL_TREE;
+	  range_known = false;
 	  ref->offset = 0;
 	  ref->base = get_base_address (TREE_OPERAND (ptr, 0));
 	}
@@ -778,11 +785,12 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
 			  ptr, null_pointer_node);
       ref->offset = 0;
     }
-  ref->offset += extra_offset;
-  if (size
-      && poly_int_tree_p (size, &size_hwi)
-      && coeffs_in_range_p (size_hwi, 0, HOST_WIDE_INT_MAX / BITS_PER_UNIT))
-    ref->max_size = ref->size = size_hwi * BITS_PER_UNIT;
+  ref->offset += extra_offset + offset;
+  if (range_known)
+    {
+      ref->max_size = max_size;
+      ref->size = size;
+    }
   else
     ref->max_size = ref->size = -1;
   ref->ref_alias_set = 0;
@@ -790,6 +798,26 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
   ref->volatile_p = false;
 }
 
+/* Init an alias-oracle reference representation from a gimple pointer
+   PTR and a gimple size SIZE in bytes.  If SIZE is NULL_TREE then the
+   size is assumed to be unknown.  The access is assumed to be only
+   to or after of the pointer target, not before it.  */
+
+void
+ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
+{
+  poly_int64 size_hwi;
+  if (size
+      && poly_int_tree_p (size, &size_hwi)
+      && coeffs_in_range_p (size_hwi, 0, HOST_WIDE_INT_MAX / BITS_PER_UNIT))
+    {
+      size_hwi = size_hwi * BITS_PER_UNIT;
+      ao_ref_init_from_ptr_and_range (ref, ptr, true, 0, size_hwi, size_hwi);
+    }
+  else
+    ao_ref_init_from_ptr_and_range (ref, ptr, false, 0, -1, -1);
+}
+
 /* S1 and S2 are TYPE_SIZE or DECL_SIZE.  Compare them:
    Return -1 if S1 < S2
    Return 1 if S1 > S2


                 reply	other threads:[~2020-10-02 11: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=20201002111514.80BCB384403D@sourceware.org \
    --to=hubicka@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).