I am unable to find an algorithm for optimizing or eliminating Phi instructions after some Control Flow Graph modifications.
I have found algorithms for destructing and constructing the SSA form, and for regenerating the SSA in the event where it was broken (by introducing multiple assignments to the same variable.)
However, I am not sure if there are any published algorithms for optimizing Phi placement in an existing SSA graph where, due to some CFG changes it may not longer be in optimal form?
Or do I need to convert out of SSA form and then back into SSA form?
Consider a node A has two predecessors, one of which is identified as dead code. Now, there could be Phi instructions for the edge of that predecessor and Node A that would no longer be valid. Are there algorithms for reconstructing the SSA to accommodate for this?