With split register allocation, only call MRI->freezeReservedRegs if
they are not already frozen. This makes a measurable difference on
AMDGPU where regalloc is split in two and
SIRegisterInfo::getReservedRegs is expensive due to the large register
file and many subregs.
I measured a ~5% speed up with:
$ cat empty.ll
define void @f() {
ret void
}
$ perf stat -r 1000 -- llc -march amdgcn -mcpu gfx1030 empty.ll -filetype null
FIXME: The assertion I added fails on a few AArch64 CodeGen tests,
apparently because AArch64RegisterInfo::hasBasePointer changes after
FinalizeISel. How should this be handled? Is the target required to
call freezeReservedRegs again whenever the set of reserved regs might
have changed?
Can this just assert the regs are frozen? Why does anything reach here without having done this already?