[AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks

Authored by paquette on Wed, Jun 2, 5:45 PM.


[AArch64][GlobalISel] Handle multiple phis in fixupPHIOpBanks

If we ended up with two phi instructions in a block, and we needed to fix up
the banks for the first one, we'd end up inserting our COPY before the second


%x = G_PHI ...
%fixup = COPY ...
%y = G_PHI ...

This is invalid MIR, and breaks assumptions made by the register allocator later
down the line. With the verifier enabled, it also emits a verification error.

This teaches fixupPHIOpBanks to walk past any phi instructions in the block
when emitting the fixup copies.

Here's an example of the crashing code (same as added testcase):

Differential Revision: https://reviews.llvm.org/D103582