public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3619] Break out ao_ref_init_from_ptr_and_range from ao_ref_init_from_ptr_and_size
@ 2020-10-02 11:15 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2020-10-02 11:15 UTC (permalink / raw)
  To: gcc-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-02 11:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 11:15 [gcc r11-3619] Break out ao_ref_init_from_ptr_and_range from ao_ref_init_from_ptr_and_size Jan Hubicka

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).