[RISCV] Rewrite scratch register search in LowerKCFI_CHECK to avoid incrementing past X31. (#240941)
We don't know where X31 is in the register list, we really shouldn't
look at values after it.
Use a list of scratch registers instead of incrementing the register id.
This allows us to check when we we've reached the end of the array.
While there change unsigned to MCRegister and MCPhysReg.
Assisted-by: Claude