LLVM 20.0.0git
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
GVNHoist.cpp File Reference
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/IteratedDominanceFrontier.h"
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.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/Scalar/GVN.h"
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <memory>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::CHIArg
 
class  llvm::InsnInfo
 
class  llvm::LoadInfo
 
class  llvm::StoreInfo
 
class  llvm::CallInfo
 
class  llvm::GVNHoist
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "gvn-hoist"
 

Typedefs

using llvm::BBSideEffectsSet = DenseMap< const BasicBlock *, bool >
 
using llvm::SmallVecInsn = SmallVector< Instruction *, 4 >
 
using llvm::SmallVecImplInsn = SmallVectorImpl< Instruction * >
 
using llvm::HoistingPointInfo = std::pair< BasicBlock *, SmallVecInsn >
 
using llvm::HoistingPointList = SmallVector< HoistingPointInfo, 4 >
 
using llvm::VNType = std::pair< unsigned, uintptr_t >
 
using llvm::VNtoInsns = DenseMap< VNType, SmallVector< Instruction *, 4 > >
 
using llvm::CHIIt = SmallVectorImpl< CHIArg >::iterator
 
using llvm::CHIArgs = iterator_range< CHIIt >
 
using llvm::OutValuesType = DenseMap< BasicBlock *, SmallVector< CHIArg, 2 > >
 
using llvm::InValuesType = DenseMap< BasicBlock *, SmallVector< std::pair< VNType, Instruction * >, 2 > >
 

Enumerations

enum  : uintptr_t { llvm::InvalidVN = ~(uintptr_t)2 }
 

Functions

 STATISTIC (NumHoisted, "Number of instructions hoisted")
 
 STATISTIC (NumRemoved, "Number of instructions removed")
 
 STATISTIC (NumLoadsHoisted, "Number of loads hoisted")
 
 STATISTIC (NumLoadsRemoved, "Number of loads removed")
 
 STATISTIC (NumStoresHoisted, "Number of stores hoisted")
 
 STATISTIC (NumStoresRemoved, "Number of stores removed")
 
 STATISTIC (NumCallsHoisted, "Number of calls hoisted")
 
 STATISTIC (NumCallsRemoved, "Number of calls removed")
 

Variables

static cl::opt< int > MaxHoistedThreshold ("gvn-max-hoisted", cl::Hidden, cl::init(-1), cl::desc("Max number of instructions to hoist " "(default unlimited = -1)"))
 
static cl::opt< int > MaxNumberOfBBSInPath ("gvn-hoist-max-bbs", cl::Hidden, cl::init(4), cl::desc("Max number of basic blocks on the path between " "hoisting locations (default = 4, unlimited = -1)"))
 
static cl::opt< int > MaxDepthInBB ("gvn-hoist-max-depth", cl::Hidden, cl::init(100), cl::desc("Hoist instructions from the beginning of the BB up to the " "maximum specified depth (default = 100, unlimited = -1)"))
 
static cl::opt< int > MaxChainLength ("gvn-hoist-max-chain-length", cl::Hidden, cl::init(10), cl::desc("Maximum length of dependent chains to hoist " "(default = 10, unlimited = -1)"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "gvn-hoist"

Definition at line 80 of file GVNHoist.cpp.

Function Documentation

◆ STATISTIC() [1/8]

STATISTIC ( NumCallsHoisted  ,
"Number of calls hoisted"   
)

◆ STATISTIC() [2/8]

STATISTIC ( NumCallsRemoved  ,
"Number of calls removed"   
)

◆ STATISTIC() [3/8]

STATISTIC ( NumHoisted  ,
"Number of instructions hoisted"   
)

◆ STATISTIC() [4/8]

STATISTIC ( NumLoadsHoisted  ,
"Number of loads hoisted"   
)

◆ STATISTIC() [5/8]

STATISTIC ( NumLoadsRemoved  ,
"Number of loads removed"   
)

◆ STATISTIC() [6/8]

STATISTIC ( NumRemoved  ,
"Number of instructions removed"   
)

◆ STATISTIC() [7/8]

STATISTIC ( NumStoresHoisted  ,
"Number of stores hoisted"   
)

◆ STATISTIC() [8/8]

STATISTIC ( NumStoresRemoved  ,
"Number of stores removed"   
)

Variable Documentation

◆ MaxChainLength

cl::opt< int > MaxChainLength("gvn-hoist-max-chain-length", cl::Hidden, cl::init(10), cl::desc("Maximum length of dependent chains to hoist " "(default = 10, unlimited = -1)")) ( "gvn-hoist-max-chain-length"  ,
cl::Hidden  ,
cl::init(10)  ,
cl::desc("Maximum length of dependent chains to hoist " "(default = 10, unlimited = -1)")   
)
static

Referenced by llvm::GVNHoist::run().

◆ MaxDepthInBB

cl::opt< int > MaxDepthInBB("gvn-hoist-max-depth", cl::Hidden, cl::init(100), cl::desc("Hoist instructions from the beginning of the BB up to the " "maximum specified depth (default = 100, unlimited = -1)")) ( "gvn-hoist-max-depth"  ,
cl::Hidden  ,
cl::init(100)  ,
cl::desc("Hoist instructions from the beginning of the BB up to the " "maximum specified depth (default = 100, unlimited = -1)")   
)
static

◆ MaxHoistedThreshold

cl::opt< int > MaxHoistedThreshold("gvn-max-hoisted", cl::Hidden, cl::init(-1), cl::desc("Max number of instructions to hoist " "(default unlimited = -1)")) ( "gvn-max-hoisted"  ,
cl::Hidden  ,
cl::init(-1)  ,
cl::desc("Max number of instructions to hoist " "(default unlimited = -1)")   
)
static

◆ MaxNumberOfBBSInPath

cl::opt< int > MaxNumberOfBBSInPath("gvn-hoist-max-bbs", cl::Hidden, cl::init(4), cl::desc("Max number of basic blocks on the path between " "hoisting locations (default = 4, unlimited = -1)")) ( "gvn-hoist-max-bbs"  ,
cl::Hidden  ,
cl::init(4)  ,
cl::desc("Max number of basic blocks on the path between " "hoisting locations (default = 4, unlimited = -1)")   
)
static