RegisterClassInfo caches information like allocation orders and reuses it for multiple machine functions where possible. However the MCPhysReg *CalleeSavedRegs field used to test whether the set of callee saved registers changed did not work: After D28566 MachineRegisterInfo::getCalleeSavedRegs() can return dynamically computed CSR sets that are only valid while the MachineRegisterInfo object of the current function exists.
This changes the code to make a copy of the CSR list instead of keeping a possibly invalid pointer around.
how about: