[LoopNest] Allow empty basic blocks without loops

Addressed Florian's post commit review comments:
1. included STLExtras.h
2. changed std::all_of to llvm::all_of

Differential Revision: https://reviews.llvm.org/D93665
This commit is contained in:
Whitney Tsang 2021-01-05 18:40:24 +00:00
parent 7afd5cfbc7
commit 601636de98
1 changed files with 3 additions and 4 deletions

View File

@ -14,6 +14,7 @@
#ifndef LLVM_ANALYSIS_LOOPNESTANALYSIS_H
#define LLVM_ANALYSIS_LOOPNESTANALYSIS_H
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/LoopAnalysisManager.h"
#include "llvm/Analysis/LoopInfo.h"
@ -130,14 +131,12 @@ public:
/// Return true if all loops in the loop nest are in simplify form.
bool areAllLoopsSimplifyForm() const {
return llvm::all_of(Loops,
[](const Loop *L) { return L->isLoopSimplifyForm(); });
return all_of(Loops, [](const Loop *L) { return L->isLoopSimplifyForm(); });
}
/// Return true if all loops in the loop nest are in rotated form.
bool areAllLoopsRotatedForm() const {
return std::all_of(Loops.begin(), Loops.end(),
[](const Loop *L) { return L->isRotatedForm(); });
return all_of(Loops, [](const Loop *L) { return L->isRotatedForm(); });
}
StringRef getName() const { return Loops.front()->getName(); }