The peephole optimizer tries to replace
%n:sgpr_32 = S_MOV_B32 x $scc = COPY %n
with a S_MOV_B32 directly into $scc.
This crashes because S_MOV_B32 cannot take $scc as input.
We currently generate code like this from GlobalISel when lowering a
G_BRCOND with a constant condition. We should probably look into
removing this kind of branch altogether, but until then we should at
least not crash.
This patch fixes the issue by making sure we don't apply the peephole
optimization when trying to S_MOV_B32 into a physical register that
doesn't have the SReg_32 register class.
Can check if the virtual register's class doesn't contain the physical register, don't need to hardcode the opcode/ class