public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-458] Allow varying ranges of unknown types in irange::verify_range [PR109711]
@ 2023-05-03 17:15 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2023-05-03 17:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2b8a27634f5d28e3e7c4a08bf065f2daada7aed2

commit r14-458-g2b8a27634f5d28e3e7c4a08bf065f2daada7aed2
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed May 3 17:29:24 2023 +0200

    Allow varying ranges of unknown types in irange::verify_range [PR109711]
    
    The old legacy code allowed building ranges of unknown types so passes
    like IPA could build and propagate VARYING.  For now it's easiest to
    allow the old behavior, it's not like you can do anything with these
    ranges except build them and copy them.
    
    Eventually we should convert all users of set_varying() to use
    supported types.  I will address this in my upcoming IPA work.
    
            PR tree-optimization/109711
    
    gcc/ChangeLog:
    
            * value-range.cc (irange::verify_range): Allow types of
            error_mark_node.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/pr109711-1.c | 16 ++++++++++++++++
 gcc/testsuite/gcc.dg/tree-ssa/pr109711-2.c | 24 ++++++++++++++++++++++++
 gcc/value-range.cc                         |  7 +++++++
 3 files changed, 47 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109711-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109711-1.c
new file mode 100644
index 00000000000..81777505002
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109711-1.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+void lspf2lpc();
+
+void interpolate_lpc(int subframe_num) {
+  float weight = 0.25 * subframe_num + 1;
+  if (weight)
+    lspf2lpc();
+}
+
+void qcelp_decode_frame() {
+  int i;
+  for (;; i++)
+    interpolate_lpc(i);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109711-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109711-2.c
new file mode 100644
index 00000000000..f80bb1afec8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109711-2.c
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+void lspf2lpc();
+
+int interpolate_lpc_q_0;
+
+void
+interpolate_lpc(int subframe_num) {
+  float weight;
+  if (interpolate_lpc_q_0)
+    weight = subframe_num;
+  else
+    weight = 1.0;
+  if (weight != 1.0)
+    lspf2lpc();
+}
+
+void
+qcelp_decode_frame() {
+  int i;
+  for (;; i++)
+    interpolate_lpc(i);
+}
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 655ffc2d6d4..def9299dc0e 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -1057,6 +1057,13 @@ irange::verify_range ()
       return;
     }
   gcc_checking_assert (m_num_ranges <= m_max_ranges);
+
+  // Legacy allowed these to represent VARYING for unknown types.
+  // Leave this in for now, until all users are converted.  Eventually
+  // we should abort in set_varying.
+  if (m_kind == VR_VARYING && m_type == error_mark_node)
+    return;
+
   unsigned prec = TYPE_PRECISION (m_type);
   if (m_kind == VR_VARYING)
     {

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

only message in thread, other threads:[~2023-05-03 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 17:15 [gcc r14-458] Allow varying ranges of unknown types in irange::verify_range [PR109711] 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).