Avoid using Loop::getSubLoopsVector.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 13 Jul 2015 17:21:14 +0000 (17:21 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 13 Jul 2015 17:21:14 +0000 (17:21 +0000)
Passes should never modify it, just use the const version. While there
reduce copying in LoopInterchange. No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242041 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopInterchange.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp

index 25546553fd4d0be03058bd54d380f39d7ade7bee..9d7e57ffebac143a35ed4145450de8e3b2c5fd70 100644 (file)
@@ -282,21 +282,21 @@ static void populateWorklist(Loop &L, SmallVector<LoopVector, 8> &V) {
   DEBUG(dbgs() << "Calling populateWorklist called\n");
   LoopVector LoopList;
   Loop *CurrentLoop = &L;
-  std::vector<Loop *> vec = CurrentLoop->getSubLoopsVector();
-  while (vec.size() != 0) {
+  const std::vector<Loop *> *Vec = &CurrentLoop->getSubLoops();
+  while (!Vec->empty()) {
     // The current loop has multiple subloops in it hence it is not tightly
     // nested.
     // Discard all loops above it added into Worklist.
-    if (vec.size() != 1) {
+    if (Vec->size() != 1) {
       LoopList.clear();
       return;
     }
     LoopList.push_back(CurrentLoop);
-    CurrentLoop = *(vec.begin());
-    vec = CurrentLoop->getSubLoopsVector();
+    CurrentLoop = Vec->front();
+    Vec = &CurrentLoop->getSubLoops();
   }
   LoopList.push_back(CurrentLoop);
-  V.push_back(LoopList);
+  V.push_back(std::move(LoopList));
 }
 
 static PHINode *getInductionVariable(Loop *L, ScalarEvolution *SE) {
index c972c48d6e90c2024b299a8c2a52247c598b8ec2..08b1c3ab71a59c78d753ec02497cd3de7f32314a 100644 (file)
@@ -3807,7 +3807,7 @@ bool LoopVectorizationLegality::canVectorize() {
   }
 
   // We can only vectorize innermost loops.
-  if (!TheLoop->getSubLoopsVector().empty()) {
+  if (!TheLoop->empty()) {
     emitAnalysis(VectorizationReport() << "loop is not the innermost loop");
     return false;
   }