[llvm] 70a495c - [NFC][LoopSimplify] modernize for loops over LoopInfo
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 09:50:21 PDT 2020
Author: Pedro Tammela
Date: 2020-10-30T16:50:07Z
New Revision: 70a495c7f0f28790e976cdecc93846f2827b2c8f
URL: https://github.com/llvm/llvm-project/commit/70a495c7f0f28790e976cdecc93846f2827b2c8f
DIFF: https://github.com/llvm/llvm-project/commit/70a495c7f0f28790e976cdecc93846f2827b2c8f.diff
LOG: [NFC][LoopSimplify] modernize for loops over LoopInfo
This patch modifies two for loops to use the range based syntax.
Since they are equivalent, this patch is tagged NFC.
Differential Revision: https://reviews.llvm.org/D90069
Added:
Modified:
llvm/lib/Transforms/Utils/LoopSimplify.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index a2e9198e3020..6c09bafc345d 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -834,8 +834,8 @@ bool LoopSimplify::runOnFunction(Function &F) {
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 @@ PreservedAnalyses LoopSimplifyPass::run(Function &F,
// 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();
More information about the llvm-commits
mailing list