Skip to content

Commit 9cdc853

Browse files
[SelectionDAG] Use a range-based for loop (NFC) (#97154)
UI++ 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 f7fec8c commit 9cdc853

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,16 +756,16 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
756756
// that COPY instructions also need DBG_VALUE, if it is the only
757757
// user of LDI->second.
758758
MachineInstr *CopyUseMI = nullptr;
759-
for (MachineRegisterInfo::use_instr_iterator
760-
UI = RegInfo->use_instr_begin(LDI->second),
761-
E = RegInfo->use_instr_end(); UI != E; ) {
762-
MachineInstr *UseMI = &*(UI++);
763-
if (UseMI->isDebugValue()) continue;
764-
if (UseMI->isCopy() && !CopyUseMI && UseMI->getParent() == EntryMBB) {
765-
CopyUseMI = UseMI; continue;
759+
for (MachineInstr &UseMI : RegInfo->use_instructions(LDI->second)) {
760+
if (UseMI.isDebugValue())
761+
continue;
762+
if (UseMI.isCopy() && !CopyUseMI && UseMI.getParent() == EntryMBB) {
763+
CopyUseMI = &UseMI;
764+
continue;
766765
}
767766
// Otherwise this is another use or second copy use.
768-
CopyUseMI = nullptr; break;
767+
CopyUseMI = nullptr;
768+
break;
769769
}
770770
if (CopyUseMI &&
771771
TRI.getRegSizeInBits(LDI->second, MRI) ==

0 commit comments

Comments
 (0)