From 7e7e280c91b9a1074e2482a964a51923d3359c09 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sun, 14 Apr 2024 15:40:36 -0400 Subject: [PATCH] reachability: Ignore virtual catch predecessor (#54077) For catch blocks, we add a virtual `0` predecessor in addition to the predecessor from the enter block. However, for reachability purposes, only real predecessors count, so ignore that here. --- base/compiler/ssair/tarjan.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/compiler/ssair/tarjan.jl b/base/compiler/ssair/tarjan.jl index bc0500901fb03..3727fe218dc1d 100644 --- a/base/compiler/ssair/tarjan.jl +++ b/base/compiler/ssair/tarjan.jl @@ -247,6 +247,9 @@ function enqueue_if_unreachable!(reach::CFGReachability, cfg::CFG, bb::Int) # target is a reducible CFG node # this node lives iff it still has an incoming forward edge for pred in cfg.blocks[bb].preds + # virtual edge does not count - if the enter is dead, that edge is + # not taken. + pred == 0 && continue !dominates(domtree, bb, pred) && return false # forward-edge end scc[bb] = 0