diff options
author | Kazu Hirata <kazu@google.com> | 2021-02-13 20:41:39 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2021-02-13 20:41:39 -0800 |
commit | d5adba10f0499b8c59b91228e8b58e1122a76428 (patch) | |
tree | 897f055e3f8a250ae3f6fe26967b1109e494ff47 /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | dfa3ead01ebf9ca0dc8c0c9c0694d187b227f269 (diff) | |
download | llvm-d5adba10f0499b8c59b91228e8b58e1122a76428.zip llvm-d5adba10f0499b8c59b91228e8b58e1122a76428.tar.gz llvm-d5adba10f0499b8c59b91228e8b58e1122a76428.tar.bz2 |
[CodeGen] Use range-based for loops (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 553ceb7..0d4e338 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -732,10 +732,8 @@ bool LDVImpl::handleDebugLabel(MachineInstr &MI, SlotIndex Idx) { bool LDVImpl::collectDebugValues(MachineFunction &mf) { bool Changed = false; - for (MachineFunction::iterator MFI = mf.begin(), MFE = mf.end(); MFI != MFE; - ++MFI) { - MachineBasicBlock *MBB = &*MFI; - for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end(); + for (MachineBasicBlock &MBB : mf) { + for (MachineBasicBlock::iterator MBBI = MBB.begin(), MBBE = MBB.end(); MBBI != MBBE;) { // Use the first debug instruction in the sequence to get a SlotIndex // for following consecutive debug instructions. @@ -746,8 +744,8 @@ bool LDVImpl::collectDebugValues(MachineFunction &mf) { // Debug instructions has no slot index. Use the previous // non-debug instruction's SlotIndex as its SlotIndex. SlotIndex Idx = - MBBI == MBB->begin() - ? LIS->getMBBStartIdx(MBB) + MBBI == MBB.begin() + ? LIS->getMBBStartIdx(&MBB) : LIS->getInstructionIndex(*std::prev(MBBI)).getRegSlot(); // Handle consecutive debug instructions with the same slot index. do { @@ -756,7 +754,7 @@ bool LDVImpl::collectDebugValues(MachineFunction &mf) { if ((MBBI->isDebugValue() && handleDebugValue(*MBBI, Idx)) || (MBBI->isDebugRef() && handleDebugInstrRef(*MBBI, Idx)) || (MBBI->isDebugLabel() && handleDebugLabel(*MBBI, Idx))) { - MBBI = MBB->erase(MBBI); + MBBI = MBB.erase(MBBI); Changed = true; } else ++MBBI; |