LLVM 20.0.0git
Macros | Functions | Variables
LoopLoadElimination.cpp File Reference
#include "llvm/Transforms/Scalar/LoopLoadElimination.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
#include "llvm/Analysis/LoopAccessAnalysis.h"
#include "llvm/Analysis/LoopAnalysisManager.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LoopVersioning.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/SizeOpts.h"
#include <algorithm>
#include <cassert>
#include <forward_list>
#include <tuple>
#include <utility>

Go to the source code of this file.

Macros

#define LLE_OPTION   "loop-load-elim"
 
#define DEBUG_TYPE   LLE_OPTION
 

Functions

 STATISTIC (NumLoopLoadEliminted, "Number of loads eliminated by LLE")
 
static bool doesStoreDominatesAllLatches (BasicBlock *StoreBlock, Loop *L, DominatorTree *DT)
 Check if the store dominates all latches, so as long as there is no intervening store this value will be loaded in the next iteration.
 
static bool isLoadConditional (LoadInst *Load, Loop *L)
 Return true if the load is not executed on all paths in the loop.
 
static bool eliminateLoadsAcrossLoops (Function &F, LoopInfo &LI, DominatorTree &DT, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, ScalarEvolution *SE, AssumptionCache *AC, LoopAccessInfoManager &LAIs)
 

Variables

static cl::opt< unsignedCheckPerElim ("runtime-check-per-loop-load-elim", cl::Hidden, cl::desc("Max number of memchecks allowed per eliminated load on average"), cl::init(1))
 
static cl::opt< unsignedLoadElimSCEVCheckThreshold ("loop-load-elimination-scev-check-threshold", cl::init(8), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed for Loop " "Load Elimination"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   LLE_OPTION

Definition at line 67 of file LoopLoadElimination.cpp.

◆ LLE_OPTION

#define LLE_OPTION   "loop-load-elim"

Definition at line 66 of file LoopLoadElimination.cpp.

Function Documentation

◆ doesStoreDominatesAllLatches()

static bool doesStoreDominatesAllLatches ( BasicBlock StoreBlock,
Loop L,
DominatorTree DT 
)
static

Check if the store dominates all latches, so as long as there is no intervening store this value will be loaded in the next iteration.

Definition at line 153 of file LoopLoadElimination.cpp.

References llvm::all_of(), and llvm::DominatorTree::dominates().

◆ eliminateLoadsAcrossLoops()

static bool eliminateLoadsAcrossLoops ( Function F,
LoopInfo LI,
DominatorTree DT,
BlockFrequencyInfo BFI,
ProfileSummaryInfo PSI,
ScalarEvolution SE,
AssumptionCache AC,
LoopAccessInfoManager LAIs 
)
static

◆ isLoadConditional()

static bool isLoadConditional ( LoadInst Load,
Loop L 
)
static

Return true if the load is not executed on all paths in the loop.

Definition at line 163 of file LoopLoadElimination.cpp.

◆ STATISTIC()

STATISTIC ( NumLoopLoadEliminted  ,
"Number of loads eliminated by LLE"   
)

Variable Documentation

◆ CheckPerElim

cl::opt< unsigned > CheckPerElim("runtime-check-per-loop-load-elim", cl::Hidden, cl::desc("Max number of memchecks allowed per eliminated load on average"), cl::init(1)) ( "runtime-check-per-loop-load-elim"  ,
cl::Hidden  ,
cl::desc("Max number of memchecks allowed per eliminated load on average")  ,
cl::init(1)   
)
static

◆ LoadElimSCEVCheckThreshold

cl::opt< unsigned > LoadElimSCEVCheckThreshold("loop-load-elimination-scev-check-threshold", cl::init(8), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed for Loop " "Load Elimination")) ( "loop-load-elimination-scev-check-threshold"  ,
cl::init(8)  ,
cl::Hidden  ,
cl::desc("The maximum number of SCEV checks allowed for Loop " "Load Elimination")   
)
static