The issues was found during D40524.
Wouldn't TRI->isSuperOrSubRegisterEq() have the same effect as TRI->checkRegistersAlias()? It isn't clear to me why the new function is needed.
Also, a comment here saying more verbosely what this is meant to be looking for would be helpful. I'm thinking something like this:
// If MO is a use of any part of the destination register but is not equal to OrigDestReg // or one of its subregisters, we cannot use SuperDestReg. For example, if OrigDestReg // is %al then an implicit use of %ah, %ax, %eax, or %rax will prevent us from using // the %eax register.
There is also TargetRegisterInfo::regsOverlap() which should be slightly more efficient (this is implemented in CodeGen because we have access to register units theres, which the MC layer doesn't know about)
Use regsOverlap instead of isSuperOrSubRegisterEq.
Thanks for the pointer. However, the whole file would benefit from this so I'd like to do the change in a subsequent commit. It should not require a review and can be directly committed, right?