Skip to content

Commit e5aef72

Browse files
[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.
1 parent 55a1e0c commit e5aef72

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/RegAllocBase.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,8 @@ void RegAllocBase::allocatePhysRegs() {
116116
// selectOrSplit failed to find a register!
117117
// Probably caused by an inline asm.
118118
MachineInstr *MI = nullptr;
119-
for (MachineRegisterInfo::reg_instr_iterator
120-
I = MRI->reg_instr_begin(VirtReg->reg()),
121-
E = MRI->reg_instr_end();
122-
I != E;) {
123-
MI = &*(I++);
119+
for (MachineInstr &MIR : MRI->reg_instructions(VirtReg->reg())) {
120+
MI = &MIR;
124121
if (MI->isInlineAsm())
125122
break;
126123
}

0 commit comments

Comments
 (0)