diff options
author | Kazu Hirata <kazu@google.com> | 2024-06-29 17:06:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-29 17:06:58 -0700 |
commit | e5aef72c0af7fd8fcdde107e31444970d3fb87ea (patch) | |
tree | 5978c56356cd3d5a3ce5c5b2eb1cac856ed4c3f4 /llvm/lib/CodeGen/RegAllocBase.cpp | |
parent | 55a1e0c0cd24aff6a23222a5690d1e7ba3686e9c (diff) | |
download | llvm-e5aef72c0af7fd8fcdde107e31444970d3fb87ea.zip llvm-e5aef72c0af7fd8fcdde107e31444970d3fb87ea.tar.gz llvm-e5aef72c0af7fd8fcdde107e31444970d3fb87ea.tar.bz2 |
[CodeGen] Use a range-based for loop (NFC) (#97177)
I++ in the loop might appear to indicate that the loop modifies the
container in some way (deletion or insertion), but the loop just
examines the container.
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocBase.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBase.cpp b/llvm/lib/CodeGen/RegAllocBase.cpp index 648036e..fb18f5a 100644 --- a/llvm/lib/CodeGen/RegAllocBase.cpp +++ b/llvm/lib/CodeGen/RegAllocBase.cpp @@ -116,11 +116,8 @@ void RegAllocBase::allocatePhysRegs() { // selectOrSplit failed to find a register! // Probably caused by an inline asm. MachineInstr *MI = nullptr; - for (MachineRegisterInfo::reg_instr_iterator - I = MRI->reg_instr_begin(VirtReg->reg()), - E = MRI->reg_instr_end(); - I != E;) { - MI = &*(I++); + for (MachineInstr &MIR : MRI->reg_instructions(VirtReg->reg())) { + MI = &MIR; if (MI->isInlineAsm()) break; } |