vpykhtin wrote: Current implementation is incorrect: I cannot move new phis to the end because they can be used by existing phis if the user added 'variable' as incoming value for an existed phi. https://github.com/llvm/llvm-project/pull/132004