aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2024-06-17 13:42:03 +0100
committerGitHub <noreply@github.com>2024-06-17 13:42:03 +0100
commit457e8954798b707c73ec76e0819760aaf65d0ffb (patch)
tree7fa358a330c5e944c4fe37ba8156c052794e054d /llvm/lib/CodeGen
parentfb59d9b9be1311ce9bb83f12bf6169378893202a (diff)
downloadllvm-457e8954798b707c73ec76e0819760aaf65d0ffb.zip
llvm-457e8954798b707c73ec76e0819760aaf65d0ffb.tar.gz
llvm-457e8954798b707c73ec76e0819760aaf65d0ffb.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineLICM.cpp3
-rw-r--r--llvm/lib/CodeGen/RegUsageInfoCollector.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 1c76d72..d81fe54f 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -440,8 +440,7 @@ static void applyBitsNotInRegMaskToRegUnitsMask(const TargetRegisterInfo &TRI,
break;
// Check if we have a valid PhysReg that is set in the mask.
- // FIXME: We shouldn't have to check for PhysReg.
- if (PhysReg && ((Word >> Bit) & 1)) {
+ if ((Word >> Bit) & 1) {
for (MCRegUnitIterator RUI(PhysReg, &TRI); RUI.isValid(); ++RUI)
ClobberedRUs.reset(*RUI);
}
diff --git a/llvm/lib/CodeGen/RegUsageInfoCollector.cpp b/llvm/lib/CodeGen/RegUsageInfoCollector.cpp
index 6657cf3..ca5e0b4 100644
--- a/llvm/lib/CodeGen/RegUsageInfoCollector.cpp
+++ b/llvm/lib/CodeGen/RegUsageInfoCollector.cpp
@@ -142,6 +142,9 @@ bool RegUsageInfoCollector::runOnMachineFunction(MachineFunction &MF) {
RegMask[Reg / 32] &= ~(1u << Reg % 32);
};
+ // Don't include $noreg in any regmasks.
+ SetRegAsDefined(MCRegister::NoRegister);
+
// Some targets can clobber registers "inside" a call, typically in
// linker-generated code.
for (const MCPhysReg Reg : TRI->getIntraCallClobberedRegs(&MF))