LLVM 20.0.0git
Macros | Functions | Variables
LoopNestAnalysis.cpp File Reference

The implementation for the loop nest analysis. More...

#include "llvm/Analysis/LoopNestAnalysis.h"
#include "llvm/ADT/BreadthFirstIterator.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/Analysis/ValueTracking.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loopnest"
 

Functions

static bool checkLoopsStructure (const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE)
 Determine whether the loops structure violates basic requirements for perfect nesting:
 
static CmpInstgetOuterLoopLatchCmp (const Loop &OuterLoop)
 
static CmpInstgetInnerLoopGuardCmp (const Loop &InnerLoop)
 
static bool checkSafeInstruction (const Instruction &I, const CmpInst *InnerLoopGuardCmp, const CmpInst *OuterLoopLatchCmp, std::optional< Loop::LoopBounds > OuterLoopLB)
 

Variables

static const charVerboseDebug = DEBUG_TYPE "-verbose"
 

Detailed Description

The implementation for the loop nest analysis.

Definition in file LoopNestAnalysis.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loopnest"

Definition at line 21 of file LoopNestAnalysis.cpp.

Function Documentation

◆ checkLoopsStructure()

static bool checkLoopsStructure ( const Loop OuterLoop,
const Loop InnerLoop,
ScalarEvolution SE 
)
static

Determine whether the loops structure violates basic requirements for perfect nesting:

  • the inner loop should be the outer loop's only child
  • the outer loop header should 'flow' into the inner loop preheader or jump around the inner loop to the outer loop latch
  • if the inner loop latch exits the inner loop, it should 'flow' into the outer loop latch. Returns true if the loop structure satisfies the basic requirements and false otherwise.

Definition at line 315 of file LoopNestAnalysis.cpp.

References llvm::all_of(), llvm::any_of(), llvm::LoopBase< BlockT, LoopT >::getExitBlock(), llvm::LoopBase< BlockT, LoopT >::getExitingBlock(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::LoopBase< BlockT, LoopT >::getSubLoops(), and llvm::Loop::isLoopSimplifyForm().

◆ checkSafeInstruction()

static bool checkSafeInstruction ( const Instruction I,
const CmpInst InnerLoopGuardCmp,
const CmpInst OuterLoopLatchCmp,
std::optional< Loop::LoopBounds OuterLoopLB 
)
static

◆ getInnerLoopGuardCmp()

static CmpInst * getInnerLoopGuardCmp ( const Loop InnerLoop)
static

◆ getOuterLoopLatchCmp()

static CmpInst * getOuterLoopLatchCmp ( const Loop OuterLoop)
static

Variable Documentation

◆ VerboseDebug

const char* VerboseDebug = DEBUG_TYPE "-verbose"
static