aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineRegisterInfo.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2023-04-18 14:12:14 +0100
committerJay Foad <jay.foad@amd.com>2023-04-18 14:14:07 +0100
commitc30c5f0122243326f89c0f0e9e78118ff34ca9ed (patch)
treef6e0d3dcf36c671025dee10b60f934e4ea18fc72 /llvm/lib/CodeGen/MachineRegisterInfo.cpp
parent54963cad87cf9028cb7b367e9c8cf977708314de (diff)
downloadllvm-c30c5f0122243326f89c0f0e9e78118ff34ca9ed.zip
llvm-c30c5f0122243326f89c0f0e9e78118ff34ca9ed.tar.gz
llvm-c30c5f0122243326f89c0f0e9e78118ff34ca9ed.tar.bz2
[MC] Simplify uses of subregs/superregs. NFC.
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineRegisterInfo.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index ab41c882..0048918 100644
--- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -644,15 +644,8 @@ void MachineRegisterInfo::setCalleeSavedRegs(ArrayRef<MCPhysReg> CSRs) {
bool MachineRegisterInfo::isReservedRegUnit(unsigned Unit) const {
const TargetRegisterInfo *TRI = getTargetRegisterInfo();
for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) {
- bool IsRootReserved = true;
- for (MCPhysReg Super : TRI->superregs_inclusive(*Root)) {
- MCRegister Reg = Super;
- if (!isReserved(Reg)) {
- IsRootReserved = false;
- break;
- }
- }
- if (IsRootReserved)
+ if (all_of(TRI->superregs_inclusive(*Root),
+ [&](MCPhysReg Super) { return isReserved(Super); }))
return true;
}
return false;