#include "llvm/Analysis/LoopNestAnalysis.h"
#include "llvm/ADT/BreadthFirstIterator.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/Analysis/ValueTracking.h"
usingnamespacellvm;
#define DEBUG_TYPE …
#ifndef NDEBUG
static const char *VerboseDebug = DEBUG_TYPE "-verbose";
#endif
static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop,
ScalarEvolution &SE);
LoopNest::LoopNest(Loop &Root, ScalarEvolution &SE)
: … { … }
std::unique_ptr<LoopNest> LoopNest::getLoopNest(Loop &Root,
ScalarEvolution &SE) { … }
static CmpInst *getOuterLoopLatchCmp(const Loop &OuterLoop) { … }
static CmpInst *getInnerLoopGuardCmp(const Loop &InnerLoop) { … }
static bool checkSafeInstruction(const Instruction &I,
const CmpInst *InnerLoopGuardCmp,
const CmpInst *OuterLoopLatchCmp,
std::optional<Loop::LoopBounds> OuterLoopLB) { … }
bool LoopNest::arePerfectlyNested(const Loop &OuterLoop, const Loop &InnerLoop,
ScalarEvolution &SE) { … }
LoopNest::LoopNestEnum LoopNest::analyzeLoopNestForPerfectNest(
const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) { … }
LoopNest::InstrVectorTy LoopNest::getInterveningInstructions(
const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) { … }
SmallVector<LoopVectorTy, 4>
LoopNest::getPerfectLoops(ScalarEvolution &SE) const { … }
unsigned LoopNest::getMaxPerfectDepth(const Loop &Root, ScalarEvolution &SE) { … }
const BasicBlock &LoopNest::skipEmptyBlockUntil(const BasicBlock *From,
const BasicBlock *End,
bool CheckUniquePred) { … }
static bool checkLoopsStructure(const Loop &OuterLoop, const Loop &InnerLoop,
ScalarEvolution &SE) { … }
AnalysisKey LoopNestAnalysis::Key;
raw_ostream &llvm::operator<<(raw_ostream &OS, const LoopNest &LN) { … }
PreservedAnalyses LoopNestPrinterPass::run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR,
LPMUpdater &U) { … }