This is a fix for: https://bugs.llvm.org/show_bug.cgi?id=49500.
As it stands, this patch is basically just a copy of D97514. Originally I suspected that there might be a better way to solve it, but eventually I realized I had arrived at roughly the same approach. I'm not sure there's much point in using getRegisterTypeForCallingConv and getNumRegistersForCallingConv versus something more direct, but I've left that unchanged.
Is OrigArgVT always going to be equal to Outs[i].ArgVT?