mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
[CFIInstrInserter] Use number of supported registers (NFC) (#71797)
This makes use of the more accurate register number introduced in PR #70222 to avoid CFI calculations for unsupported registers. This has basically no impact right now, but results in a 0.2% compile-time improvement at O0 when applied on top of #70958. The reason is that the extra registers that PR adds push the `BitVector` out of the `SmallVector` space, which results in an outsized impact. (This does make me wonder whether `BitVector` should accept an `N` template parameter to allow using a larger `SmallVector`...)
This commit is contained in:
@@ -151,7 +151,7 @@ void CFIInstrInserter::calculateCFAInfo(MachineFunction &MF) {
|
||||
Register InitialRegister =
|
||||
MF.getSubtarget().getFrameLowering()->getInitialCFARegister(MF);
|
||||
InitialRegister = TRI.getDwarfRegNum(InitialRegister, true);
|
||||
unsigned NumRegs = TRI.getNumRegs();
|
||||
unsigned NumRegs = TRI.getNumSupportedRegs(MF);
|
||||
|
||||
// Initialize MBBMap.
|
||||
for (MachineBasicBlock &MBB : MF) {
|
||||
@@ -181,7 +181,7 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
|
||||
MachineFunction *MF = MBBInfo.MBB->getParent();
|
||||
const std::vector<MCCFIInstruction> &Instrs = MF->getFrameInstructions();
|
||||
const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo();
|
||||
unsigned NumRegs = TRI.getNumRegs();
|
||||
unsigned NumRegs = TRI.getNumSupportedRegs(*MF);
|
||||
BitVector CSRSaved(NumRegs), CSRRestored(NumRegs);
|
||||
|
||||
// Determine cfa offset and register set by the block.
|
||||
|
||||
Reference in New Issue
Block a user