[llvm] [CodeGen] Use range-based for loops (NFC) (PR #97500)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 17:55:54 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/97500
None
>From 5d695c5d33578cf88964b2e49d76c788b3d6b046 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 2 Jul 2024 16:54:03 -0700
Subject: [PATCH] [CodeGen] Use range-based for loops (NFC)
---
.../CodeGen/AssignmentTrackingAnalysis.cpp | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index cbec482d4cdc5..146276b4fd0bb 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -572,11 +572,10 @@ class MemLocFragmentFill {
bool FirstMeet = true;
// LiveIn locs for BB is the meet of the already-processed preds' LiveOut
// locs.
- for (auto I = pred_begin(&BB), E = pred_end(&BB); I != E; I++) {
+ for (const BasicBlock *Pred : predecessors(&BB)) {
// Ignore preds that haven't been processed yet. This is essentially the
// same as initialising all variables to implicit top value (⊤) which is
// the identity value for the meet operation.
- const BasicBlock *Pred = *I;
if (!Visited.count(Pred))
continue;
@@ -941,10 +940,10 @@ class MemLocFragmentFill {
LLVM_DEBUG(dbgs() << BB->getName()
<< " has new OutLocs, add succs to worklist: [ ");
LiveOut[BB] = std::move(LiveSet);
- for (auto I = succ_begin(BB), E = succ_end(BB); I != E; I++) {
- if (OnPending.insert(*I).second) {
- LLVM_DEBUG(dbgs() << I->getName() << " ");
- Pending.push(BBToOrder[*I]);
+ for (BasicBlock *Succ : successors(BB)) {
+ if (OnPending.insert(Succ).second) {
+ LLVM_DEBUG(dbgs() << Succ->getName() << " ");
+ Pending.push(BBToOrder[Succ]);
}
}
LLVM_DEBUG(dbgs() << "]\n");
@@ -2360,10 +2359,10 @@ bool AssignmentTrackingLowering::run(FunctionVarLocsBuilder *FnVarLocsBuilder) {
LLVM_DEBUG(dbgs() << BB->getName()
<< " has new OutLocs, add succs to worklist: [ ");
LiveOut[BB] = std::move(LiveSet);
- for (auto I = succ_begin(BB), E = succ_end(BB); I != E; I++) {
- if (OnPending.insert(*I).second) {
- LLVM_DEBUG(dbgs() << I->getName() << " ");
- Pending.push(BBToOrder[*I]);
+ for (BasicBlock *Succ : successors(BB)) {
+ if (OnPending.insert(Succ).second) {
+ LLVM_DEBUG(dbgs() << Succ->getName() << " ");
+ Pending.push(BBToOrder[Succ]);
}
}
LLVM_DEBUG(dbgs() << "]\n");
More information about the llvm-commits
mailing list