aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2021-07-28 08:30:02 -0400
committerAndrew MacLeod <amacleod@redhat.com>2021-07-28 08:32:38 -0400
commit04600a47224b1ff85c6fb870218b51969cceff21 (patch)
tree646473f2570d2573ee2f6572876e4d2b8bde1c8c /gcc
parent31534ac26e0ec1deeb648b2548dbbe17574ea78c (diff)
downloadgcc-04600a47224b1ff85c6fb870218b51969cceff21.zip
gcc-04600a47224b1ff85c6fb870218b51969cceff21.tar.gz
gcc-04600a47224b1ff85c6fb870218b51969cceff21.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-range-gori.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 17032ac..c124b3c 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))
{