Skip to content

[CodeGen] Use range-based for loops (NFC) #98459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions llvm/lib/CodeGen/AllocationOrder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ AllocationOrder AllocationOrder::create(unsigned VirtReg, const VirtRegMap &VRM,
LLVM_DEBUG({
if (!Hints.empty()) {
dbgs() << "hints:";
for (unsigned I = 0, E = Hints.size(); I != E; ++I)
dbgs() << ' ' << printReg(Hints[I], TRI);
for (MCPhysReg Hint : Hints)
dbgs() << ' ' << printReg(Hint, TRI);
dbgs() << '\n';
}
});
#ifndef NDEBUG
for (unsigned I = 0, E = Hints.size(); I != E; ++I)
assert(is_contained(Order, Hints[I]) &&
"Target hint is outside allocation order.");
#endif
assert(all_of(Hints,
[&](MCPhysReg Hint) { return is_contained(Order, Hint); }) &&
"Target hint is outside allocation order.");
return AllocationOrder(std::move(Hints), Order, HardHints);
}
7 changes: 3 additions & 4 deletions llvm/lib/CodeGen/MachineBasicBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1484,10 +1484,9 @@ void MachineBasicBlock::ReplaceUsesOfBlockWith(MachineBasicBlock *Old,

// Scan the operands of this machine instruction, replacing any uses of Old
// with New.
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (I->getOperand(i).isMBB() &&
I->getOperand(i).getMBB() == Old)
I->getOperand(i).setMBB(New);
for (MachineOperand &MO : I->operands())
if (MO.isMBB() && MO.getMBB() == Old)
MO.setMBB(New);
}

// Update the successor information.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,11 @@ void ScheduleDAGFast::ListScheduleBottomUp() {
}

// Add the nodes that aren't ready back onto the available list.
for (unsigned i = 0, e = NotReady.size(); i != e; ++i) {
NotReady[i]->isPending = false;
for (SUnit *SU : NotReady) {
SU->isPending = false;
// May no longer be available due to backtracking.
if (NotReady[i]->isAvailable)
AvailableQueue.push(NotReady[i]);
if (SU->isAvailable)
AvailableQueue.push(SU);
}
NotReady.clear();

Expand Down
Loading