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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 15:47:49 PDT 2024


================
@@ -39,14 +39,14 @@ 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]) &&
+  for (MCPhysReg Hint : Hints)
+    assert(is_contained(Order, Hint) &&
            "Target hint is outside allocation order.");
----------------
kazutakahirata wrote:

Good point!  Fixed in the latest iteration.

https://github.com/llvm/llvm-project/pull/98459


More information about the llvm-commits mailing list