From 3c1eb9903b22b5f6e42a6fcfc49322170ffa3749 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 18 Mar 2014 22:00:32 +0000 Subject: [PATCH] [LV] While I'm here, use range based for loops which are so much cleaner for this kind of walk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204188 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Vectorize/LoopVectorize.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 1f02bf6cbe9..dc1ca5c291e 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -989,12 +989,12 @@ private: } }; -static void addInnerLoop(Loop *L, SmallVectorImpl &V) { - if (L->empty()) - return V.push_back(L); +static void addInnerLoop(Loop &L, SmallVectorImpl &V) { + if (L.empty()) + return V.push_back(&L); - for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) - addInnerLoop(*I, V); + for (Loop *InnerL : L) + addInnerLoop(*InnerL, V); } /// The LoopVectorize Pass. @@ -1051,8 +1051,8 @@ struct LoopVectorize : public FunctionPass { // and can invalidate iterators across the loops. SmallVector Worklist; - for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) - addInnerLoop(*I, Worklist); + for (Loop *L : *LI) + addInnerLoop(*L, Worklist); // Now walk the identified inner loops. bool Changed = false; -- 2.34.1