Skip to content

Commit 457e895

Browse files
authored
[CodeGen] Do not include $noreg in any regmask operands. NFCI. (#95775)
Saying that a call preserves $noreg seems weird and required a workaround in MachineLICM.
1 parent fb59d9b commit 457e895

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ static void applyBitsNotInRegMaskToRegUnitsMask(const TargetRegisterInfo &TRI,
440440
break;
441441

442442
// Check if we have a valid PhysReg that is set in the mask.
443-
// FIXME: We shouldn't have to check for PhysReg.
444-
if (PhysReg && ((Word >> Bit) & 1)) {
443+
if ((Word >> Bit) & 1) {
445444
for (MCRegUnitIterator RUI(PhysReg, &TRI); RUI.isValid(); ++RUI)
446445
ClobberedRUs.reset(*RUI);
447446
}

llvm/lib/CodeGen/RegUsageInfoCollector.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ bool RegUsageInfoCollector::runOnMachineFunction(MachineFunction &MF) {
142142
RegMask[Reg / 32] &= ~(1u << Reg % 32);
143143
};
144144

145+
// Don't include $noreg in any regmasks.
146+
SetRegAsDefined(MCRegister::NoRegister);
147+
145148
// Some targets can clobber registers "inside" a call, typically in
146149
// linker-generated code.
147150
for (const MCPhysReg Reg : TRI->getIntraCallClobberedRegs(&MF))

0 commit comments

Comments
 (0)