[llvm] [TableGen] Use a range-based for loop. NFC (PR #123443)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 20:32:07 PST 2025


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/123443

None

>From 8ab119744b9da18422b44932986789772e78743d Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 17 Jan 2025 20:31:24 -0800
Subject: [PATCH] [TableGen] Use a range-based for loop. NFC

---
 llvm/utils/TableGen/Common/CodeGenSchedule.cpp | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index a5ca060533bcef..1eb74dc857cc45 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -1590,22 +1590,16 @@ bool PredTransitions::substituteVariants(const PredTransition &Trans) {
   // Visit each original write sequence.
   for (const auto &WriteSequence : Trans.WriteSequences) {
     // Push a new (empty) write sequence onto all partial Transitions.
-    for (std::vector<PredTransition>::iterator I = TransVec.begin() + StartIdx,
-                                               E = TransVec.end();
-         I != E; ++I) {
-      I->WriteSequences.emplace_back();
-    }
+    for (auto &PT : drop_begin(TransVec, StartIdx))
+      PT.WriteSequences.emplace_back();
     Subst |=
         substituteVariantOperand(WriteSequence, /*IsRead=*/false, StartIdx);
   }
   // Visit each original read sequence.
   for (const auto &ReadSequence : Trans.ReadSequences) {
     // Push a new (empty) read sequence onto all partial Transitions.
-    for (std::vector<PredTransition>::iterator I = TransVec.begin() + StartIdx,
-                                               E = TransVec.end();
-         I != E; ++I) {
-      I->ReadSequences.emplace_back();
-    }
+    for (auto &PT : drop_begin(TransVec, StartIdx))
+      PT.ReadSequences.emplace_back();
     Subst |= substituteVariantOperand(ReadSequence, /*IsRead=*/true, StartIdx);
   }
   return Subst;



More information about the llvm-commits mailing list