SelectionDAGISel calls MachineRegisterInfo::freezeReservedRegs
right after ISel and MachineRegisterInfo caches the reserved registers
vector. However, RegAlloc calls the same function again before the
allocation process. This might be expensive if the target has a large
number of registers.
The second call was removed in r168630 in 2012, but it caused a few
failures and got reverted. They don’t fail right now, but there are 4
PowerPC tests failing. So, it seems some targets still need to update
the reserved registers before RegAlloc.
Failing Tests (4):
LLVM :: CodeGen/PowerPC/ppc64-anyregcc-crash.ll LLVM :: CodeGen/PowerPC/ppc64-anyregcc.ll LLVM :: CodeGen/PowerPC/ppc64-patchpoint.ll LLVM :: CodeGen/PowerPC/ppc64-stackmap.ll
I think a comment with an example of why this may be needed by a target is in order here. For example, PPC requires it because it has a different set of reserved registers if a function ends up having a TargetOpcode::PATCHPOINT node in it.
Perhaps @hfinkel has a different suggestion here.