[PATCH] D90069: [LoopSimplify] modernize for loops over LoopInfo

Pedro Tammela via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 12:26:32 PDT 2020


tammela created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
tammela requested review of this revision.

This patch modifies two for loops to use the range based syntax.
Since they are equivalent, this patch is tagged NFC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90069

Files:
  llvm/lib/Transforms/Utils/LoopSimplify.cpp


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -834,8 +834,8 @@
   bool PreserveLCSSA = mustPreserveAnalysisID(LCSSAID);
 
   // Simplify each loop nest in the function.
-  for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
-    Changed |= simplifyLoop(*I, DT, LI, SE, AC, MSSAU.get(), PreserveLCSSA);
+  for (auto *L : *LI)
+    Changed |= simplifyLoop(L, DT, LI, SE, AC, MSSAU.get(), PreserveLCSSA);
 
 #ifndef NDEBUG
   if (PreserveLCSSA) {
@@ -864,9 +864,9 @@
 
   // Note that we don't preserve LCSSA in the new PM, if you need it run LCSSA
   // after simplifying the loops. MemorySSA is preserved if it exists.
-  for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
+  for (auto *L : *LI)
     Changed |=
-        simplifyLoop(*I, DT, LI, SE, AC, MSSAU.get(), /*PreserveLCSSA*/ false);
+        simplifyLoop(L, DT, LI, SE, AC, MSSAU.get(), /*PreserveLCSSA*/ false);
 
   if (!Changed)
     return PreservedAnalyses::all();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90069.300379.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201023/41c13083/attachment.bin>


More information about the llvm-commits mailing list