LLVM  5.0.0
Macros | Functions | Variables
ConstantHoisting.cpp File Reference
#include "llvm/Transforms/Scalar/ConstantHoisting.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
#include <tuple>
Include dependency graph for ConstantHoisting.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "consthoist"
 

Functions

 STATISTIC (NumConstantsHoisted,"Number of constants hoisted")
 
 STATISTIC (NumConstantsRebased,"Number of constants rebased")
 
 INITIALIZE_PASS_BEGIN (ConstantHoistingLegacyPass,"consthoist","Constant Hoisting", false, false) INITIALIZE_PASS_END(ConstantHoistingLegacyPass
 
static void findBestInsertionSet (DominatorTree &DT, BlockFrequencyInfo &BFI, BasicBlock *Entry, SmallPtrSet< BasicBlock *, 8 > &BBs)
 Given BBs as input, find another set of BBs which collectively dominates BBs and have the minimal sum of frequencies. More...
 
static llvm::Optional< APInt > calculateOffsetDiff (const APInt &V1, const APInt &V2)
 
static bool updateOperand (Instruction *Inst, unsigned Idx, Instruction *Mat)
 Updates the operand at Idx in instruction Inst with the result of instruction Mat. More...
 

Variables

static cl::opt< bool > ConstHoistWithBlockFrequency ("consthoist-with-block-frequency", cl::init(true), cl::Hidden, cl::desc("Enable the use of the block frequency analysis to reduce the ""chance to execute const materialization more frequently than ""without hoisting."))
 
 consthoist
 
Constant Hoisting
 
Constant false
 

Macro Definition Documentation

#define DEBUG_TYPE   "consthoist"

Definition at line 53 of file ConstantHoisting.cpp.

Function Documentation

static llvm::Optional<APInt> calculateOffsetDiff ( const APInt &  V1,
const APInt &  V2 
)
static
static void findBestInsertionSet ( DominatorTree &  DT,
BlockFrequencyInfo &  BFI,
BasicBlock *  Entry,
SmallPtrSet< BasicBlock *, 8 > &  BBs 
)
static
INITIALIZE_PASS_BEGIN ( ConstantHoistingLegacyPass  ,
"consthoist"  ,
"Constant Hoisting"  ,
false  ,
false   
)
STATISTIC ( NumConstantsHoisted  ,
"Number of constants hoisted"   
)
STATISTIC ( NumConstantsRebased  ,
"Number of constants rebased"   
)
static bool updateOperand ( Instruction *  Inst,
unsigned  Idx,
Instruction *  Mat 
)
static

Updates the operand at Idx in instruction Inst with the result of instruction Mat.

If the instruction is a PHI node then special handling for duplicate values form the same incoming basic block is required.

Returns
The update will always succeed, but the return value indicated if Mat was used for the update or not.

Definition at line 589 of file ConstantHoisting.cpp.

References llvm::User::setOperand().

Variable Documentation

consthoist

Definition at line 98 of file ConstantHoisting.cpp.

cl::opt<bool> ConstHoistWithBlockFrequency("consthoist-with-block-frequency", cl::init(true), cl::Hidden, cl::desc("Enable the use of the block frequency analysis to reduce the ""chance to execute const materialization more frequently than ""without hoisting."))
static
Constant false

Definition at line 98 of file ConstantHoisting.cpp.

Constant Hoisting

Definition at line 98 of file ConstantHoisting.cpp.