public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] tree-optimization/106510 - Do not register edges for statements not understood.
@ 2022-08-02 23:24 Andrew MacLeod
  0 siblings, 0 replies; only message in thread
From: Andrew MacLeod @ 2022-08-02 23:24 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

When only interger ranges were supported, we knew all gimple COND 
statements were supported.  this is no longer true with float support, 
so gracefully do nothing when they are encountered.

You can choose to remove the "unsupported relational" range-ops if you 
so wish.  we shouldn't need those.,

Bootstrapped on 86_64-pc-linux-gnu with no regressions.  pushed.

Andrew

[-- Attachment #2: al.diff --]
[-- Type: text/x-patch, Size: 1782 bytes --]

commit 70daecc03235aa7187b03681cebed6e04b32678e
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Tue Aug 2 17:31:37 2022 -0400

    Do not register edges for statements not understood.
    
    Previously, all gimple_cond types were undserstoof, with float values,
    this is no longer true.  We should gracefully do nothing if the
    gcond type is not supported.
    
            PR tree-optimization/106510
            gcc/
            * gimple-range-fold.cc (fur_source::register_outgoing_edges):
              Check for unsupported statements early.
    
            gcc/testsuite
            * gcc.dg/pr106510.c: New.

diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 923094abd62..689d8279627 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -1496,6 +1496,10 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge
   tree name;
   basic_block bb = gimple_bb (s);
 
+  range_op_handler handler (s);
+  if (!handler)
+    return;
+
   if (e0)
     {
       // If this edge is never taken, ignore it.
@@ -1524,8 +1528,6 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge
   tree ssa2 = gimple_range_ssa_p (gimple_range_operand2 (s));
   if (ssa1 && ssa2)
     {
-      range_op_handler handler (s);
-      gcc_checking_assert (handler);
       if (e0)
 	{
 	  relation_kind relation = handler.op1_op2_relation (e0_range);
diff --git a/gcc/testsuite/gcc.dg/pr106510.c b/gcc/testsuite/gcc.dg/pr106510.c
new file mode 100644
index 00000000000..24e91123f63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr106510.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void foo ();
+void ine_ok() {
+  float y, x;
+  if (x < y || x > y || y)
+    foo ();
+}
+

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

only message in thread, other threads:[~2022-08-02 23:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 23:24 [COMMITTED] tree-optimization/106510 - Do not register edges for statements not understood Andrew MacLeod

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