Skip to content

Commit

Permalink
Clarify comment and add Core.throw anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw authored Oct 17, 2023
1 parent e09f407 commit bcf996a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/reverse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ function adjointcfg(pr::Primal)
branch!(rb, preds[i].id, unless = cond)
end
if isempty(preds) || (!isempty(branches(b)) && branches(b)[end] == IRTools.unreachable)
# An unreachable block in the primal will also be unreachable in the adjoint
# If `b` is unreachable, then no context produced by the primal should end up branching to `rb`
push!(rb, xcall(Core, :throw, "unreachable")) # `throw` is necessary for inference not to hit the `unreachable`
branch!(rb, 0)
end
end
Expand Down

0 comments on commit bcf996a

Please sign in to comment.