This change optimizes out unnecessary copies that appear in the case when the PHI node input register is defined by the REG_SEQUENCE.
The REG_SEQUENCE not necessarily is located in the PHI's predecessor block.
rocBLAS error is really caused by the subregisters tracking bug. PostRA Machine Sink cannot discover that sreg_32 writes are defining superreg that is used as source operand in subsequent COPY. Machine Sink then sinks the superreg COPY to the "THEN" block of the branch but the copies of sreg32 that deine superreg COPY source operand - to the "ELSE" block. As a result "THEN" block receives uninitialized register.
This issue is going to be addressed in separate change later on.
The optimization in current change removes the IR pattern that triggers the Machine Sink bug.
Since it need to be done anyway to remove unnecessary copies, it goes first.
Factoring this out is a separate patch