Skip to content

Commit 121b6bf

Browse files
committed
handle DetachNode pointing to dead BB
1 parent 3d6c064 commit 121b6bf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

base/compiler/typeinfer.jl

+8
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,21 @@ function type_annotate!(sv::InferenceState)
321321
nexpr = length(body)
322322

323323
# replace gotoifnot with its condition if the branch target is unreachable
324+
# use serial projection to turn DetachNode into branch
324325
for i = 1:nexpr
325326
expr = body[i]
326327
if isa(expr, Expr) && expr.head === :gotoifnot
327328
tgt = expr.args[2]::Int
328329
if !isa(states[tgt], VarTable)
329330
body[i] = expr.args[1]
330331
end
332+
elseif isa(expr, DetachNode)
333+
# Unecessary for ReattachNode since if that points to a dead BB
334+
# if will get automatically removed.
335+
tgt = expr.reattach
336+
if !isa(states[tgt], VarTable)
337+
body[i] = GotoNode(expr.label)
338+
end
331339
end
332340
end
333341

0 commit comments

Comments
 (0)