diff options
author | Kazu Hirata <kazu@google.com> | 2025-05-04 00:26:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-04 00:26:19 -0700 |
commit | a9699a334bc9666570418a3bed9520bcdc21518b (patch) | |
tree | 8106a3ea7b5e04c4e9a47c2348c4fd29f1746900 /llvm/lib/CodeGen/MachineCSE.cpp | |
parent | 1add318c176b92f5daba46b3a099aff60aa8d8c8 (diff) | |
download | llvm-a9699a334bc9666570418a3bed9520bcdc21518b.zip llvm-a9699a334bc9666570418a3bed9520bcdc21518b.tar.gz llvm-a9699a334bc9666570418a3bed9520bcdc21518b.tar.bz2 |
[CodeGen] Use range-based for loops (NFC) (#138434)
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCSE.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp index 6d14509..bebdead 100644 --- a/llvm/lib/CodeGen/MachineCSE.cpp +++ b/llvm/lib/CodeGen/MachineCSE.cpp @@ -325,9 +325,8 @@ bool MachineCSEImpl::hasLivePhysRegDefUses(const MachineInstr *MI, } // Finally, add all defs to PhysRefs as well. - for (unsigned i = 0, e = PhysDefs.size(); i != e; ++i) - for (MCRegAliasIterator AI(PhysDefs[i].second, TRI, true); AI.isValid(); - ++AI) + for (const auto &Def : PhysDefs) + for (MCRegAliasIterator AI(Def.second, TRI, true); AI.isValid(); ++AI) PhysRefs.insert(*AI); return !PhysRefs.empty(); @@ -348,9 +347,8 @@ bool MachineCSEImpl::PhysRegDefsReach(MachineInstr *CSMI, MachineInstr *MI, if (MBB->pred_size() != 1 || *MBB->pred_begin() != CSMBB) return false; - for (unsigned i = 0, e = PhysDefs.size(); i != e; ++i) { - if (MRI->isAllocatable(PhysDefs[i].second) || - MRI->isReserved(PhysDefs[i].second)) + for (const auto &PhysDef : PhysDefs) { + if (MRI->isAllocatable(PhysDef.second) || MRI->isReserved(PhysDef.second)) // Avoid extending live range of physical registers if they are //allocatable or reserved. return false; |