[polly] r211981 - [C++11] Use more range based fors

Tobias Grosser tobias at grosser.es
Sat Jun 28 01:59:45 PDT 2014


Author: grosser
Date: Sat Jun 28 03:59:45 2014
New Revision: 211981

URL: http://llvm.org/viewvc/llvm-project?rev=211981&view=rev
Log:
[C++11] Use more range based fors

Modified:
    polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/CodeGen/Utils.cpp
    polly/trunk/lib/Support/ScopHelper.cpp
    polly/trunk/lib/Transform/IndependentBlocks.cpp
    polly/trunk/lib/Transform/Pluto.cpp
    polly/trunk/lib/Transform/Pocc.cpp
    polly/trunk/lib/Transform/ScheduleOptimizer.cpp

Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Sat Jun 28 03:59:45 2014
@@ -97,12 +97,11 @@ struct DOTGraphTraits<ScopDetection *> :
   static std::string escapeString(std::string String) {
     std::string Escaped;
 
-    for (std::string::iterator SI = String.begin(), SE = String.end(); SI != SE;
-         ++SI) {
-      if (*SI == '"')
+    for (const auto &C : String) {
+      if (C == '"')
         Escaped += '\\';
 
-      Escaped += *SI;
+      Escaped += C;
     }
     return Escaped;
   }

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Jun 28 03:59:45 2014
@@ -556,22 +556,18 @@ void ScopStmt::buildScattering(SmallVect
 }
 
 void ScopStmt::buildAccesses(TempScop &tempScop, const Region &CurRegion) {
-  const AccFuncSetType *AccFuncs = tempScop.getAccessFunctions(BB);
-
-  for (AccFuncSetType::const_iterator I = AccFuncs->begin(),
-                                      E = AccFuncs->end();
-       I != E; ++I) {
-    MemAccs.push_back(new MemoryAccess(I->first, I->second, this));
+  for (auto &&Access : *tempScop.getAccessFunctions(BB)) {
+    MemAccs.push_back(new MemoryAccess(Access.first, Access.second, this));
 
     // We do not track locations for scalar memory accesses at the moment.
     //
     // We do not have a use for this information at the moment. If we need this
     // at some point, the "instruction -> access" mapping needs to be enhanced
     // as a single instruction could then possibly perform multiple accesses.
-    if (!I->first.isScalar()) {
-      assert(!InstructionToAccess.count(I->second) &&
+    if (!Access.first.isScalar()) {
+      assert(!InstructionToAccess.count(Access.second) &&
              "Unexpected 1-to-N mapping on instruction to access map!");
-      InstructionToAccess[I->second] = MemAccs.back();
+      InstructionToAccess[Access.second] = MemAccs.back();
     }
   }
 }
@@ -650,10 +646,8 @@ __isl_give isl_set *ScopStmt::addConditi
   do {
     if (BranchingBB != CurrentRegion->getEntry()) {
       if (const BBCond *Condition = tempScop.getBBCond(BranchingBB))
-        for (BBCond::const_iterator CI = Condition->begin(),
-                                    CE = Condition->end();
-             CI != CE; ++CI) {
-          isl_set *ConditionSet = buildConditionSet(*CI);
+        for (const auto &C : *Condition) {
+          isl_set *ConditionSet = buildConditionSet(C);
           Domain = isl_set_intersect(Domain, ConditionSet);
         }
     }
@@ -894,9 +888,8 @@ void ScopStmt::print(raw_ostream &OS) co
   } else
     OS.indent(16) << "n/a\n";
 
-  for (MemoryAccessVec::const_iterator I = MemAccs.begin(), E = MemAccs.end();
-       I != E; ++I)
-    (*I)->print(OS);
+  for (MemoryAccess *Access : MemAccs)
+    Access->print(OS);
 }
 
 void ScopStmt::dump() const { print(dbgs()); }
@@ -911,11 +904,7 @@ void Scop::setContext(__isl_take isl_set
 }
 
 void Scop::addParams(std::vector<const SCEV *> NewParameters) {
-  for (std::vector<const SCEV *>::iterator PI = NewParameters.begin(),
-                                           PE = NewParameters.end();
-       PI != PE; ++PI) {
-    const SCEV *Parameter = *PI;
-
+  for (const SCEV *Parameter : NewParameters) {
     if (ParameterIds.find(Parameter) != ParameterIds.end())
       continue;
 
@@ -983,18 +972,17 @@ void Scop::realignParams() {
   // Add all parameters into a common model.
   isl_space *Space = isl_space_params_alloc(IslCtx, ParameterIds.size());
 
-  for (ParamIdType::iterator PI = ParameterIds.begin(), PE = ParameterIds.end();
-       PI != PE; ++PI) {
-    const SCEV *Parameter = PI->first;
+  for (const auto &ParamID : ParameterIds) {
+    const SCEV *Parameter = ParamID.first;
     isl_id *id = getIdForParam(Parameter);
-    Space = isl_space_set_dim_id(Space, isl_dim_param, PI->second, id);
+    Space = isl_space_set_dim_id(Space, isl_dim_param, ParamID.second, id);
   }
 
   // Align the parameters of all data structures to the model.
   Context = isl_set_align_params(Context, Space);
 
-  for (iterator I = begin(), E = end(); I != E; ++I)
-    (*I)->realignParams();
+  for (ScopStmt *Stmt : *this)
+    Stmt->realignParams();
 }
 
 Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
@@ -1024,8 +1012,8 @@ Scop::~Scop() {
   isl_set_free(AssumedContext);
 
   // Free the statements;
-  for (iterator I = begin(), E = end(); I != E; ++I)
-    delete *I;
+  for (ScopStmt *Stmt : *this)
+    delete Stmt;
 }
 
 std::string Scop::getContextStr() const { return stringFromIslObj(Context); }
@@ -1066,12 +1054,8 @@ void Scop::printContext(raw_ostream &OS)
 
   OS.indent(4) << getContextStr() << "\n";
 
-  for (ParamVecType::const_iterator PI = Parameters.begin(),
-                                    PE = Parameters.end();
-       PI != PE; ++PI) {
-    const SCEV *Parameter = *PI;
+  for (const SCEV *Parameter : Parameters) {
     int Dim = ParameterIds.find(Parameter)->second;
-
     OS.indent(4) << "p" << Dim << ": " << *Parameter << "\n";
   }
 }
@@ -1079,8 +1063,8 @@ void Scop::printContext(raw_ostream &OS)
 void Scop::printStatements(raw_ostream &OS) const {
   OS << "Statements {\n";
 
-  for (const_iterator SI = begin(), SE = end(); SI != SE; ++SI)
-    OS.indent(4) << (**SI);
+  for (ScopStmt *Stmt : *this)
+    OS.indent(4) << *Stmt;
 
   OS.indent(4) << "}\n";
 }

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Sat Jun 28 03:59:45 2014
@@ -536,14 +536,8 @@ public:
     const BasicBlock *BB = S->getBasicBlock();
 
     // Check all the operands of instructions in the basic block.
-    for (BasicBlock::const_iterator BI = BB->begin(), BE = BB->end(); BI != BE;
-         ++BI) {
-      const Instruction &Inst = *BI;
-      for (Instruction::const_op_iterator II = Inst.op_begin(),
-                                          IE = Inst.op_end();
-           II != IE; ++II) {
-        Value *SrcVal = *II;
-
+    for (const Instruction &Inst : *BB) {
+      for (Value *SrcVal : Inst.operands()) {
         if (Instruction *OpInst = dyn_cast<Instruction>(SrcVal))
           if (S->getParent()->getRegion().contains(OpInst))
             continue;

Modified: polly/trunk/lib/CodeGen/Utils.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Utils.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Utils.cpp (original)
+++ polly/trunk/lib/CodeGen/Utils.cpp Sat Jun 28 03:59:45 2014
@@ -37,9 +37,9 @@ BasicBlock *polly::executeScopConditiona
     std::string OldName = OldBlock->getName();
 
     // Update ScopInfo.
-    for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI)
-      if ((*SI)->getBasicBlock() == OldBlock) {
-        (*SI)->setBasicBlock(NewBlock);
+    for (ScopStmt *Stmt : S)
+      if (Stmt->getBasicBlock() == OldBlock) {
+        Stmt->setBasicBlock(NewBlock);
         break;
       }
 

Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Sat Jun 28 03:59:45 2014
@@ -94,9 +94,9 @@ void polly::simplifyRegion(Scop *S, Pass
     BasicBlock *OldEntry = R->getEntry();
     BasicBlock *NewEntry = SplitBlock(OldEntry, OldEntry->begin(), P);
 
-    for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI)
-      if ((*SI)->getBasicBlock() == OldEntry) {
-        (*SI)->setBasicBlock(NewEntry);
+    for (ScopStmt *Stmt : *S)
+      if (Stmt->getBasicBlock() == OldEntry) {
+        Stmt->setBasicBlock(NewEntry);
         break;
       }
 
@@ -107,8 +107,8 @@ void polly::simplifyRegion(Scop *S, Pass
   if (!R->getExitingBlock()) {
     BasicBlock *NewExit = createSingleExitEdge(R, P);
 
-    for (Region::const_iterator RI = R->begin(), RE = R->end(); RI != RE; ++RI)
-      (*RI)->replaceExitRecursive(NewExit);
+    for (auto &&SubRegion : *R)
+      SubRegion->replaceExitRecursive(NewExit);
   }
 }
 

Modified: polly/trunk/lib/Transform/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndependentBlocks.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/Transform/IndependentBlocks.cpp Sat Jun 28 03:59:45 2014
@@ -246,17 +246,15 @@ void IndependentBlocks::moveOperandTree(
 bool IndependentBlocks::createIndependentBlocks(BasicBlock *BB,
                                                 const Region *R) {
   std::vector<Instruction *> WorkList;
-  for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE; ++II)
-    if (!isSafeToMove(II) && !canSynthesize(II, LI, SE, R))
-      WorkList.push_back(II);
+  for (Instruction &Inst : *BB)
+    if (!isSafeToMove(&Inst) && !canSynthesize(&Inst, LI, SE, R))
+      WorkList.push_back(&Inst);
 
   ReplacedMapType ReplacedMap;
   Instruction *InsertPos = BB->getFirstNonPHIOrDbg();
 
-  for (std::vector<Instruction *>::iterator I = WorkList.begin(),
-                                            E = WorkList.end();
-       I != E; ++I)
-    moveOperandTree(*I, R, ReplacedMap, InsertPos);
+  for (Instruction *Inst : WorkList)
+    moveOperandTree(Inst, R, ReplacedMap, InsertPos);
 
   // The BB was changed if we replaced any operand.
   return !ReplacedMap.empty();
@@ -265,7 +263,7 @@ bool IndependentBlocks::createIndependen
 bool IndependentBlocks::createIndependentBlocks(const Region *R) {
   bool Changed = false;
 
-  for (const auto &BB : R->blocks())
+  for (BasicBlock *BB : R->blocks())
     Changed |= createIndependentBlocks(BB, R);
 
   return Changed;
@@ -275,10 +273,10 @@ bool IndependentBlocks::eliminateDeadCod
   std::vector<Instruction *> WorkList;
 
   // Find all trivially dead instructions.
-  for (const auto &BB : R->blocks())
-    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
-      if (isInstructionTriviallyDead(I))
-        WorkList.push_back(I);
+  for (BasicBlock *BB : R->blocks())
+    for (Instruction &Inst : *BB)
+      if (isInstructionTriviallyDead(&Inst))
+        WorkList.push_back(&Inst);
 
   if (WorkList.empty())
     return false;
@@ -332,14 +330,14 @@ bool IndependentBlocks::splitExitBlock(R
   toUpdate.push_back(R);
 
   while (!toUpdate.empty()) {
-    Region *Reg = toUpdate.back();
+    Region *R = toUpdate.back();
     toUpdate.pop_back();
 
-    for (const auto &SubR : *Reg)
-      if (SubR->getExit() == ExitBB)
-        toUpdate.push_back(SubR.get());
+    for (auto &&SubRegion : *R)
+      if (SubRegion->getExit() == ExitBB)
+        toUpdate.push_back(SubRegion.get());
 
-    Reg->replaceExit(NewExit);
+    R->replaceExit(NewExit);
   }
 
   RI->setRegionFor(NewExit, R->getParent());
@@ -349,7 +347,7 @@ bool IndependentBlocks::splitExitBlock(R
 bool IndependentBlocks::translateScalarToArray(const Region *R) {
   bool Changed = false;
 
-  for (const auto &BB : R->blocks())
+  for (BasicBlock *BB : R->blocks())
     Changed |= translateScalarToArray(BB, R);
 
   return Changed;
@@ -446,19 +444,16 @@ bool IndependentBlocks::translateScalarT
 
 bool IndependentBlocks::isIndependentBlock(const Region *R,
                                            BasicBlock *BB) const {
-  for (BasicBlock::iterator II = BB->begin(), IE = --BB->end(); II != IE;
-       ++II) {
-    Instruction *Inst = &*II;
-
-    if (canSynthesize(Inst, LI, SE, R))
+  for (Instruction &Inst : *BB) {
+    if (canSynthesize(&Inst, LI, SE, R))
       continue;
 
     // A value inside the Scop is referenced outside.
-    for (User *U : Inst->users()) {
+    for (User *U : Inst.users()) {
       if (isEscapeUse(U, R)) {
         DEBUG(dbgs() << "Instruction not independent:\n");
         DEBUG(dbgs() << "Instruction used outside the Scop!\n");
-        DEBUG(Inst->print(dbgs()));
+        DEBUG(Inst.print(dbgs()));
         DEBUG(dbgs() << "\n");
         return false;
       }
@@ -467,17 +462,16 @@ bool IndependentBlocks::isIndependentBlo
     if (DisableIntraScopScalarToArray)
       continue;
 
-    for (Instruction::op_iterator OI = Inst->op_begin(), OE = Inst->op_end();
-         OI != OE; ++OI) {
-      if (isEscapeOperand(*OI, BB, R)) {
+    for (Value *Op : Inst.operands()) {
+      if (isEscapeOperand(Op, BB, R)) {
         DEBUG(dbgs() << "Instruction in function '";
               BB->getParent()->printAsOperand(dbgs(), false);
               dbgs() << "' not independent:\n");
         DEBUG(dbgs() << "Uses invalid operator\n");
-        DEBUG(Inst->print(dbgs()));
+        DEBUG(Inst.print(dbgs()));
         DEBUG(dbgs() << "\n");
         DEBUG(dbgs() << "Invalid operator is: ";
-              (*OI)->printAsOperand(dbgs(), false); dbgs() << "\n");
+              Op->printAsOperand(dbgs(), false); dbgs() << "\n");
         return false;
       }
     }
@@ -487,7 +481,7 @@ bool IndependentBlocks::isIndependentBlo
 }
 
 bool IndependentBlocks::areAllBlocksIndependent(const Region *R) const {
-  for (const auto &BB : R->blocks())
+  for (BasicBlock *BB : R->blocks())
     if (!isIndependentBlock(R, BB))
       return false;
 
@@ -525,8 +519,7 @@ bool IndependentBlocks::runOnFunction(ll
 
   DEBUG(dbgs() << "Run IndepBlock on " << F.getName() << '\n');
 
-  for (ScopDetection::iterator I = SD->begin(), E = SD->end(); I != E; ++I) {
-    const Region *R = *I;
+  for (const Region *R : *SD) {
     Changed |= createIndependentBlocks(R);
     Changed |= eliminateDeadCode(R);
     // This may change the RegionTree.
@@ -536,8 +529,8 @@ bool IndependentBlocks::runOnFunction(ll
   DEBUG(dbgs() << "Before Scalar to Array------->\n");
   DEBUG(F.dump());
 
-  for (ScopDetection::iterator I = SD->begin(), E = SD->end(); I != E; ++I)
-    Changed |= translateScalarToArray(*I);
+  for (const Region *R : *SD)
+    Changed |= translateScalarToArray(R);
 
   DEBUG(dbgs() << "After Independent Blocks------------->\n");
   DEBUG(F.dump());
@@ -548,9 +541,8 @@ bool IndependentBlocks::runOnFunction(ll
 }
 
 void IndependentBlocks::verifyAnalysis() const {
-  for (ScopDetection::const_iterator I = SD->begin(), E = SD->end(); I != E;
-       ++I)
-    verifyScop(*I);
+  for (const Region *R : *SD)
+    verifyScop(R);
 }
 
 void IndependentBlocks::verifyScop(const Region *R) const {

Modified: polly/trunk/lib/Transform/Pluto.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Pluto.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Pluto.cpp (original)
+++ polly/trunk/lib/Transform/Pluto.cpp Sat Jun 28 03:59:45 2014
@@ -147,8 +147,7 @@ static int getSingleMap(__isl_take isl_m
 }
 
 void PlutoOptimizer::extendScattering(Scop &S, unsigned NewDimensions) {
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
+  for (ScopStmt *Stmt : S) {
     unsigned OldDimensions = Stmt->getNumScattering();
     isl_space *Space;
     isl_map *Map, *New;
@@ -183,8 +182,7 @@ bool PlutoOptimizer::runOnScop(Scop &S)
   ToPlutoNames = isl_union_map_empty(S.getParamSpace());
 
   int counter = 0;
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
+  for (ScopStmt *Stmt : S) {
     std::string Name = "S_" + convertInt(counter);
     isl_map *Identity = isl_map_identity(isl_space_map_from_domain_and_range(
         Stmt->getDomainSpace(), Stmt->getDomainSpace()));
@@ -230,8 +228,7 @@ bool PlutoOptimizer::runOnScop(Scop &S)
   Schedule =
       isl_union_map_apply_domain(Schedule, isl_union_map_reverse(ToPlutoNames));
 
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
+  for (ScopStmt *Stmt : S) {
     isl_set *Domain = Stmt->getDomain();
     isl_union_map *StmtBand;
     StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(Schedule),
@@ -246,8 +243,8 @@ bool PlutoOptimizer::runOnScop(Scop &S)
 
   unsigned MaxScatDims = 0;
 
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI)
-    MaxScatDims = std::max((*SI)->getNumScattering(), MaxScatDims);
+  for (ScopStmt *Stmt : S)
+    MaxScatDims = std::max(Stmt->getNumScattering(), MaxScatDims);
 
   extendScattering(S, MaxScatDims);
   return false;

Modified: polly/trunk/lib/Transform/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Pocc.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Pocc.cpp (original)
+++ polly/trunk/lib/Transform/Pocc.cpp Sat Jun 28 03:59:45 2014
@@ -143,11 +143,9 @@ bool Pocc::runTransform(Scop &S) {
   if (!newScoplib.updateScattering()) {
     errs() << "Failure when calculating the optimization with "
               "the following command: ";
-    for (std::vector<const char *>::const_iterator AI = arguments.begin(),
-                                                   AE = arguments.end();
-         AI != AE; ++AI)
-      if (*AI)
-        errs() << " " << *AI;
+    for (const char *Arg : arguments)
+      if (Arg)
+        errs() << " " << Arg;
     errs() << "\n";
     return false;
   } else
@@ -164,8 +162,8 @@ bool Pocc::runTransform(Scop &S) {
   while (lastLoop) {
     bool isSingleValued = true;
 
-    for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-      isl_map *scat = (*SI)->getScattering();
+    for (ScopStmt *Stmt : S) {
+      isl_map *scat = Stmt->getScattering();
       isl_map *projected = isl_map_project_out(scat, isl_dim_out, lastLoop,
                                                scatterDims - lastLoop);
 
@@ -182,9 +180,9 @@ bool Pocc::runTransform(Scop &S) {
   }
 
   // Strip mine the innermost loop.
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    isl_map *scat = (*SI)->getScattering();
-    int scatDims = (*SI)->getNumScattering();
+  for (ScopStmt *Stmt : S) {
+    isl_map *scat = Stmt->getScattering();
+    int scatDims = Stmt->getNumScattering();
     isl_space *Space = isl_space_alloc(S.getIslCtx(), S.getNumParams(),
                                        scatDims, scatDims + 1);
     isl_basic_map *map = isl_basic_map_universe(isl_space_copy(Space));
@@ -227,7 +225,7 @@ bool Pocc::runTransform(Scop &S) {
     transform = isl_map_set_tuple_name(transform, isl_dim_in, "scattering");
 
     scat = isl_map_apply_range(scat, isl_map_copy(transform));
-    (*SI)->setScattering(scat);
+    Stmt->setScattering(scat);
   }
 
   return false;
@@ -245,11 +243,9 @@ void Pocc::printScop(raw_ostream &OS) co
 
   OS << "Command line: ";
 
-  for (std::vector<const char *>::const_iterator AI = arguments.begin(),
-                                                 AE = arguments.end();
-       AI != AE; ++AI)
-    if (*AI)
-      OS << " " << *AI;
+  for (const char *Arg : arguments)
+    if (Arg)
+      OS << " " << Arg;
 
   OS << "\n";
 

Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=211981&r1=211980&r2=211981&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Sat Jun 28 03:59:45 2014
@@ -209,8 +209,7 @@ private:
 char IslScheduleOptimizer::ID = 0;
 
 void IslScheduleOptimizer::extendScattering(Scop &S, unsigned NewDimensions) {
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
+  for (ScopStmt *Stmt : S) {
     unsigned OldDimensions = Stmt->getNumScattering();
     isl_space *Space;
     isl_map *Map, *New;
@@ -562,8 +561,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
 
   isl_union_map *ScheduleMap = getScheduleMap(Schedule);
 
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
+  for (ScopStmt *Stmt : S) {
     isl_map *StmtSchedule;
     isl_set *Domain = Stmt->getDomain();
     isl_union_map *StmtBand;
@@ -585,8 +583,8 @@ bool IslScheduleOptimizer::runOnScop(Sco
 
   unsigned MaxScatDims = 0;
 
-  for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI)
-    MaxScatDims = std::max((*SI)->getNumScattering(), MaxScatDims);
+  for (ScopStmt *Stmt : S)
+    MaxScatDims = std::max(Stmt->getNumScattering(), MaxScatDims);
 
   extendScattering(S, MaxScatDims);
   return false;





More information about the llvm-commits mailing list