[llvm] [CodeGen] Use range-based for loops (NFC) (PR #97187)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 29 19:54:12 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/97187
None
>From 409dd5f7b50adabe33d5fafe7698b65c300256af Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 29 Jun 2024 18:56:47 -0700
Subject: [PATCH] [CodeGen] Use range-based for loops (NFC)
---
llvm/lib/CodeGen/MachineSSAUpdater.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineSSAUpdater.cpp b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
index 5b21c5653b46b..43c4b9c6c557f 100644
--- a/llvm/lib/CodeGen/MachineSSAUpdater.cpp
+++ b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
@@ -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) {
@@ -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.
More information about the llvm-commits
mailing list