public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2568] Return undefined on edges which are not executed.
@ 2021-07-28 12:47 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2021-07-28 12:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:04600a47224b1ff85c6fb870218b51969cceff21

commit r12-2568-g04600a47224b1ff85c6fb870218b51969cceff21
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Wed Jul 28 08:30:02 2021 -0400

    Return undefined on edges which are not executed.
    
    When a branch has been folded, mark any range requests on the unexecutable edge as
    UNDEFINED.
    
            * gimple-range-gori.cc (gori_compute::outgoing_edge_range_p): Check for
            cond_false and cond_true on branches.

Diff:
---
 gcc/gimple-range-gori.cc | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 17032acf8d7..c124b3c1ce4 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -1104,6 +1104,21 @@ gori_compute::outgoing_edge_range_p (irange &r, edge e, tree name,
 
   fur_stmt src (stmt, &q);
 
+  // If this edge is never taken, return undefined.
+  gcond *gc = dyn_cast<gcond *> (stmt);
+  if (gc)
+    {
+      if (((e->flags & EDGE_TRUE_VALUE) && gimple_cond_false_p (gc))
+	  || ((e->flags & EDGE_FALSE_VALUE) && gimple_cond_true_p (gc)))
+	{
+	  r.set_undefined ();
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	      fprintf (dump_file, "Outgoing edge %d->%d unexecutable.\n",
+		       e->src->index, e->dest->index);
+	  return true;
+	}
+    }
+
   // If NAME can be calculated on the edge, use that.
   if (is_export_p (name, e->src))
     {


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

only message in thread, other threads:[~2021-07-28 12:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 12:47 [gcc r12-2568] Return undefined on edges which are not executed 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).