The machine copy propagation logic has some problem:
When do machine copy propagation for subreg we need to consider the CopyDstReg and CopySrcReg's regclass and size.
(because we want to get SubReg from CopySrcReg by using SubregIdx which we got from CopyDstReg)
Take follow case for example:
MCP: Replacing $ecx with $k0 in renamable $k1 = COPY renamable $ecx from renamable $rcx = COPY renamable $k0, implicit-def $ecx
We can not use SubregIdx (ecx of rcx) to get anything from k0 register.
The upper test case problem was fix/escaped by D146930
But there is still risk in it. More details PLS refer to comments in D146930
Now this patch is to enhance the safety in propagating SubReg.
You should be able to use existing, generated class relation queries