Zero-input phi nodes are accepted by the verifier and bitcode reader, but currently rejected by the IR parser. Allow them there as well.
Because phi nodes must have one entry for each predecessor, such phis can only occur in blocks without predecessors, aka unreachable code.
Usually, when removing the last predecessor from a block, we also remove phi nodes in it. However, this is not possible for invalidation reasons sometimes, which is why we ended up allowing zero-entry phis at some point in the past.
I've dropped the verifier unit test, because this is now covered by the regular IR test.
This fixes at least part of https://github.com/llvm/llvm-project/issues/57446.
Move this error check directly after parse of Ty? That could be an independent change. It doesn't appear to have any testing currently, but I think we can trigger it with something like: