public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-978] Misc range temporary fixes.
@ 2022-06-03  8:40 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-06-03  8:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0fd3c7063db52b8f509a9572ff8078a0f91176da

commit r13-978-g0fd3c7063db52b8f509a9572ff8078a0f91176da
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Jun 2 19:52:41 2022 +0200

    Misc range temporary fixes.
    
    This fixes a couples places that were using int_range_max, but needed
    a generic temporary.  Found while merging the frange work.
    
    Also, copying between range temporaries is actually useful :).
    
    Tested on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * gimple-range-cache.cc (ranger_cache::range_from_dom): Use
            Value_Range.
            * gimple-range.cc (gimple_ranger::register_inferred_ranges): Same.
            * value-range.h (Value_Range::Value_Range): Implement copy
            constructor for Value_Range.

Diff:
---
 gcc/gimple-range-cache.cc | 2 +-
 gcc/gimple-range.cc       | 9 ++++++---
 gcc/value-range.h         | 8 +++++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 85eed4421f4..f3494363a10 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -1372,7 +1372,7 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb,
 	      // each incoming edge now and accumulate the results.
 	      r.set_undefined ();
 	      edge_iterator ei;
-	      int_range_max er;
+	      Value_Range er (TREE_TYPE (name));
 	      FOR_EACH_EDGE (e, ei, prev_bb->preds)
 		{
 		  edge_range (er, e, name, RFD_READ_ONLY);
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 67dafb2a2c0..f3a46555f91 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -461,17 +461,20 @@ gimple_ranger::register_inferred_ranges (gimple *s)
   tree lhs = gimple_get_lhs (s);
   if (lhs)
     {
-      int_range_max tmp;
+      Value_Range tmp (TREE_TYPE (lhs));
       if (range_of_stmt (tmp, s, lhs) && !tmp.varying_p ()
 	  && update_global_range (tmp, lhs) && dump_file)
 	{
-	  value_range vr = tmp;
+	  // ?? This section should be adjusted when non-iranges can
+	  // be exported.  For now, the only way update_global_range
+	  // above can succeed is with an irange so this is safe.
+	  value_range vr = as_a <irange> (tmp);
 	  fprintf (dump_file, "Global Exported: ");
 	  print_generic_expr (dump_file, lhs, TDF_SLIM);
 	  fprintf (dump_file, " = ");
 	  vr.dump (dump_file);
 	  int_range_max same = vr;
-	  if (same != tmp)
+	  if (same != as_a <irange> (tmp))
 	    {
 	      fprintf (dump_file, " ...  irange was : ");
 	      tmp.dump (dump_file);
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 26e41ed2982..dc6f6b0f935 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -314,6 +314,7 @@ public:
   Value_Range ();
   Value_Range (const vrange &r);
   Value_Range (tree type);
+  Value_Range (const Value_Range &);
   void set_type (tree type);
   vrange& operator= (const vrange &);
   bool operator== (const Value_Range &r) const;
@@ -344,7 +345,6 @@ private:
   unsupported_range m_unsupported;
   vrange *m_vrange;
   int_range_max m_irange;
-  DISABLE_COPY_AND_ASSIGN (Value_Range);
 };
 
 inline
@@ -370,6 +370,12 @@ Value_Range::Value_Range (tree type)
   init (type);
 }
 
+inline
+Value_Range::Value_Range (const Value_Range &r)
+{
+  m_vrange = r.m_vrange;
+}
+
 // Initialize object so it is possible to store temporaries of TYPE
 // into it.


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

only message in thread, other threads:[~2022-06-03  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03  8:40 [gcc r13-978] Misc range temporary fixes Aldy Hernandez

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