optimize: Delete incoming unreachable edges from PhiNode (#53877)
Incoming IR very rarely contains PhiNodes, but we do allow it to make
things easier on downstream packages like Diffractor that want to
generate the same code structures in both typed and untyped mode.
However, this does of course mean that once inference is finished, any
PhiNodes in the original source must be adjusted to maintain IRCode
invariants. One particular important invariant here is that the edges
list in a PhiNode must match the predecessor list, so in particular if a
predecessor becomes unreachable during inference, we must filter that
edge before passing it on to the optimizer.
---------
Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>