LLVM  8.0.1
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/Transforms/Utils/Local.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/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.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/Pass.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.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <memory>
#include <utility>
#include <vector>
Include dependency graph for GVNHoist.cpp:

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
 
class  llvm::GVNHoistLegacyPass
 

Namespaces

 llvm
 This class represents lattice values for constants.
 

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, unsigned >
 
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  : unsigned { llvm::InvalidVN = ~2U }
 

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")
 
static void llvm::combineKnownMetadata (Instruction *ReplInst, Instruction *I)
 
 INITIALIZE_PASS_BEGIN (GVNHoistLegacyPass, "gvn-hoist", "Early GVN Hoisting of Expressions", false, false) INITIALIZE_PASS_END(GVNHoistLegacyPass
 

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)"))
 
gvn hoist
 When an instruction is found to only use loop invariant operands that is safe to hoist, this instruction is called to do the dirty work. More...
 
gvn Early GVN Hoisting of Expressions
 
gvn Early GVN Hoisting of false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "gvn-hoist"

Definition at line 85 of file GVNHoist.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( GVNHoistLegacyPass  ,
"gvn-hoist ,
"Early GVN Hoisting of Expressions ,
false  ,
false   
)

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

◆ STATISTIC() [1/8]

STATISTIC ( NumHoisted  ,
"Number of instructions hoisted"   
)

◆ STATISTIC() [2/8]

STATISTIC ( NumRemoved  ,
"Number of instructions removed"   
)

◆ STATISTIC() [3/8]

STATISTIC ( NumLoadsHoisted  ,
"Number of loads hoisted"   
)

◆ STATISTIC() [4/8]

STATISTIC ( NumLoadsRemoved  ,
"Number of loads removed"   
)

◆ STATISTIC() [5/8]

STATISTIC ( NumStoresHoisted  ,
"Number of stores hoisted"   
)

◆ STATISTIC() [6/8]

STATISTIC ( NumStoresRemoved  ,
"Number of stores removed"   
)

◆ STATISTIC() [7/8]

STATISTIC ( NumCallsHoisted  ,
"Number of calls hoisted"   
)

◆ STATISTIC() [8/8]

STATISTIC ( NumCallsRemoved  ,
"Number of calls removed"   
)

Variable Documentation

◆ Expressions

gvn Early GVN Hoisting of Expressions

◆ false

gvn Early GVN Hoisting of false

Definition at line 1204 of file GVNHoist.cpp.

◆ hoist

static void hoist

When an instruction is found to only use loop invariant operands that is safe to hoist, this instruction is called to do the dirty work.

Definition at line 1204 of file GVNHoist.cpp.

◆ 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)"))
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)"))
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)"))
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)"))
static

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