From 2ffeb9f523ed600eefac0049fe39828efcd4fb66 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 28 Oct 2014 11:54:05 +0000 Subject: [PATCH] LoopRerollPass.cpp: Use range-based loop. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220772 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopRerollPass.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/Transforms/Scalar/LoopRerollPass.cpp b/lib/Transforms/Scalar/LoopRerollPass.cpp index 98ed624e1bb..e69689d73e8 100644 --- a/lib/Transforms/Scalar/LoopRerollPass.cpp +++ b/lib/Transforms/Scalar/LoopRerollPass.cpp @@ -241,10 +241,9 @@ protected: PossibleRedSet.insert(PossibleReds[i].getPHI()); PossibleRedIdx[PossibleReds[i].getPHI()] = i; - for (SimpleLoopReduction::iterator J = PossibleReds[i].begin(), - JE = PossibleReds[i].end(); J != JE; ++J) { - PossibleRedSet.insert(*J); - PossibleRedIdx[*J] = i; + for (Instruction *J : PossibleReds[i]) { + PossibleRedSet.insert(J); + PossibleRedIdx[J] = i; } } } @@ -659,16 +658,15 @@ bool LoopReroll::ReductionTracker::validateSelected() { RI != RIE; ++RI) { int i = *RI; int PrevIter = 0, BaseCount = 0, Count = 0; - for (SimpleLoopReduction::iterator J = PossibleReds[i].begin(), - JE = PossibleReds[i].end(); J != JE; ++J) { - // Note that all instructions in the chain must have been found because - // all instructions in the function must have been assigned to some - // iteration. - int Iter = PossibleRedIter[*J]; + for (Instruction *J : PossibleReds[i]) { + // Note that all instructions in the chain must have been found because + // all instructions in the function must have been assigned to some + // iteration. + int Iter = PossibleRedIter[J]; if (Iter != PrevIter && Iter != PrevIter + 1 && !PossibleReds[i].getReducedValue()->isAssociative()) { DEBUG(dbgs() << "LRR: Out-of-order non-associative reduction: " << - *J << "\n"); + J << "\n"); return false; }