Skip to content

Commit

Permalink
[CodeGen] Use range-based for loops (NFC) (llvm#97187)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored and kbluck committed Jul 6, 2024
1 parent 62c0a13 commit 2e6258b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/MachineSSAUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Register LookForIdenticalPHI(MachineBasicBlock *BB,
return Register();

AvailableValsTy AVals;
for (unsigned i = 0, e = PredValues.size(); i != e; ++i)
AVals[PredValues[i].first] = PredValues[i].second;
for (const auto &[SrcBB, SrcReg] : PredValues)
AVals[SrcBB] = SrcReg;
while (I != BB->end() && I->isPHI()) {
bool Same = true;
for (unsigned i = 1, e = I->getNumOperands(); i != e; i += 2) {
Expand Down Expand Up @@ -196,8 +196,8 @@ Register MachineSSAUpdater::GetValueInMiddleOfBlock(MachineBasicBlock *BB,
InsertNewDef(TargetOpcode::PHI, BB, Loc, RegAttrs, MRI, TII);

// Fill in all the predecessors of the PHI.
for (unsigned i = 0, e = PredValues.size(); i != e; ++i)
InsertedPHI.addReg(PredValues[i].second).addMBB(PredValues[i].first);
for (const auto &[SrcBB, SrcReg] : PredValues)
InsertedPHI.addReg(SrcReg).addMBB(SrcBB);

// See if the PHI node can be merged to a single value. This can happen in
// loop cases when we get a PHI of itself and one other value.
Expand Down

0 comments on commit 2e6258b

Please sign in to comment.