aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocBase.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-06-29 17:06:58 -0700
committerGitHub <noreply@github.com>2024-06-29 17:06:58 -0700
commite5aef72c0af7fd8fcdde107e31444970d3fb87ea (patch)
tree5978c56356cd3d5a3ce5c5b2eb1cac856ed4c3f4 /llvm/lib/CodeGen/RegAllocBase.cpp
parent55a1e0c0cd24aff6a23222a5690d1e7ba3686e9c (diff)
downloadllvm-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.cpp7
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;
}