aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2021-09-22 09:30:21 +0200
committerAldy Hernandez <aldyh@redhat.com>2021-09-22 13:28:16 +0200
commitfec75ab8c02be904de2963c0adb6d1e940a59761 (patch)
tree0669ad429f65951fb8257725317d0c627fb3ed85 /gcc
parent7e5e44bd1729b7a9b458d512ddf61bfba5031869 (diff)
downloadgcc-fec75ab8c02be904de2963c0adb6d1e940a59761.zip
gcc-fec75ab8c02be904de2963c0adb6d1e940a59761.tar.gz
gcc-fec75ab8c02be904de2963c0adb6d1e940a59761.tar.bz2
Check for BB before calling register_outgoing_edges.
We may be asked to fold an artificial statement not in the CFG. Since there are no outgoing edges from those, avoid calling register_outgoing_edges. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-fold.cc (fold_using_range::range_of_range_op): Move check for non-empty BB here. (fur_source::register_outgoing_edges): ...from here.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-range-fold.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index d7fa0f2..1da1bef 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -650,7 +650,9 @@ fold_using_range::range_of_range_op (irange &r, gimple *s, fur_source &src)
src.register_relation (s, rel, lhs, op2);
}
}
- else if (is_a<gcond *> (s))
+ // Check for an existing BB, as we maybe asked to fold an
+ // artificial statement not in the CFG.
+ else if (is_a<gcond *> (s) && gimple_bb (s))
{
basic_block bb = gimple_bb (s);
edge e0 = EDGE_SUCC (bb, 0);
@@ -1404,10 +1406,6 @@ fur_source::register_outgoing_edges (gcond *s, irange &lhs_range, edge e0, edge
range_operator *handler;
basic_block bb = gimple_bb (s);
- // We may get asked to fold an artificial statement not in the CFG.
- if (!bb)
- return;
-
if (e0)
{
// If this edge is never taken, ignore it.