Avoid using Loop::getSubLoopsVector.

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
This commit is contained in:
Benjamin Kramer 2015-07-13 17:21:14 +00:00
parent af8cf90e2f
commit ed5546e50b
2 changed files with 7 additions and 7 deletions

View File

@ -282,21 +282,21 @@ static void populateWorklist(Loop &L, SmallVector<LoopVector, 8> &V) {
DEBUG(dbgs() << "Calling populateWorklist called\n"); DEBUG(dbgs() << "Calling populateWorklist called\n");
LoopVector LoopList; LoopVector LoopList;
Loop *CurrentLoop = &L; Loop *CurrentLoop = &L;
std::vector<Loop *> vec = CurrentLoop->getSubLoopsVector(); const std::vector<Loop *> *Vec = &CurrentLoop->getSubLoops();
while (vec.size() != 0) { while (!Vec->empty()) {
// The current loop has multiple subloops in it hence it is not tightly // The current loop has multiple subloops in it hence it is not tightly
// nested. // nested.
// Discard all loops above it added into Worklist. // Discard all loops above it added into Worklist.
if (vec.size() != 1) { if (Vec->size() != 1) {
LoopList.clear(); LoopList.clear();
return; return;
} }
LoopList.push_back(CurrentLoop); LoopList.push_back(CurrentLoop);
CurrentLoop = *(vec.begin()); CurrentLoop = Vec->front();
vec = CurrentLoop->getSubLoopsVector(); Vec = &CurrentLoop->getSubLoops();
} }
LoopList.push_back(CurrentLoop); LoopList.push_back(CurrentLoop);
V.push_back(LoopList); V.push_back(std::move(LoopList));
} }
static PHINode *getInductionVariable(Loop *L, ScalarEvolution *SE) { static PHINode *getInductionVariable(Loop *L, ScalarEvolution *SE) {

View File

@ -3807,7 +3807,7 @@ bool LoopVectorizationLegality::canVectorize() {
} }
// We can only vectorize innermost loops. // We can only vectorize innermost loops.
if (!TheLoop->getSubLoopsVector().empty()) { if (!TheLoop->empty()) {
emitAnalysis(VectorizationReport() << "loop is not the innermost loop"); emitAnalysis(VectorizationReport() << "loop is not the innermost loop");
return false; return false;
} }