LLVM  12.0.0git
Macros | Functions | Variables
SCCP.cpp File Reference
#include "llvm/Transforms/Scalar/SCCP.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueLattice.h"
#include "llvm/Analysis/ValueLatticeUtils.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/PredicateInfo.h"
#include <cassert>
#include <utility>
#include <vector>
Include dependency graph for SCCP.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "sccp"
 

Functions

 STATISTIC (NumInstRemoved, "Number of instructions removed")
 
 STATISTIC (NumDeadBlocks, "Number of basic blocks unreachable")
 
 STATISTIC (NumInstReplaced, "Number of instructions replaced with (simpler) instruction")
 
 STATISTIC (IPNumInstRemoved, "Number of instructions removed by IPSCCP")
 
 STATISTIC (IPNumArgsElimed,"Number of arguments constant propagated by IPSCCP")
 
 STATISTIC (IPNumGlobalConst, "Number of globals found to be constant by IPSCCP")
 
 STATISTIC (IPNumInstReplaced, "Number of instructions replaced with (simpler) instruction by IPSCCP")
 
static ValueLatticeElement::MergeOptions getMaxWidenStepsOpts ()
 Returns MergeOptions with MaxWidenSteps set to MaxNumRangeExtensions. More...
 
static ValueLatticeElement getValueFromMetadata (const Instruction *I)
 
static bool tryToReplaceWithConstant (SCCPSolver &Solver, Value *V)
 
static bool simplifyInstsInBlock (SCCPSolver &Solver, BasicBlock &BB, SmallPtrSetImpl< Value * > &InsertedValues, Statistic &InstRemovedStat, Statistic &InstReplacedStat)
 
static bool runSCCP (Function &F, const DataLayout &DL, const TargetLibraryInfo *TLI)
 
 INITIALIZE_PASS_BEGIN (SCCPLegacyPass, "sccp", "Sparse Conditional Constant Propagation", false, false) INITIALIZE_PASS_END(SCCPLegacyPass
 
static void findReturnsToZap (Function &F, SmallVector< ReturnInst *, 8 > &ReturnsToZap, SCCPSolver &Solver)
 
static bool removeNonFeasibleEdges (const SCCPSolver &Solver, BasicBlock *BB, DomTreeUpdater &DTU)
 

Variables

static const unsigned MaxNumRangeExtensions = 10
 
 sccp
 
Sparse Conditional Constant Propagation
 
Sparse Conditional Constant false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "sccp"

Definition at line 69 of file SCCP.cpp.

Function Documentation

◆ findReturnsToZap()

static void findReturnsToZap ( Function F,
SmallVector< ReturnInst *, 8 > &  ReturnsToZap,
SCCPSolver &  Solver 
)
static

◆ getMaxWidenStepsOpts()

static ValueLatticeElement::MergeOptions getMaxWidenStepsOpts ( )
static

Returns MergeOptions with MaxWidenSteps set to MaxNumRangeExtensions.

Definition at line 88 of file SCCP.cpp.

References MaxNumRangeExtensions, and llvm::ValueLatticeElement::MergeOptions::setMaxWidenSteps().

◆ getValueFromMetadata()

static ValueLatticeElement getValueFromMetadata ( const Instruction I)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SCCPLegacyPass  ,
"sccp"  ,
"Sparse Conditional Constant Propagation ,
false  ,
false   
)

◆ removeNonFeasibleEdges()

static bool removeNonFeasibleEdges ( const SCCPSolver &  Solver,
BasicBlock BB,
DomTreeUpdater DTU 
)
static

◆ runSCCP()

static bool runSCCP ( Function F,
const DataLayout DL,
const TargetLibraryInfo TLI 
)
static

◆ simplifyInstsInBlock()

static bool simplifyInstsInBlock ( SCCPSolver &  Solver,
BasicBlock BB,
SmallPtrSetImpl< Value * > &  InsertedValues,
Statistic InstRemovedStat,
Statistic InstReplacedStat 
)
static

◆ STATISTIC() [1/7]

STATISTIC ( NumInstRemoved  ,
"Number of instructions removed"   
)

◆ STATISTIC() [2/7]

STATISTIC ( NumDeadBlocks  ,
"Number of basic blocks unreachable"   
)

◆ STATISTIC() [3/7]

STATISTIC ( NumInstReplaced  ,
"Number of instructions replaced with (simpler) instruction"   
)

◆ STATISTIC() [4/7]

STATISTIC ( IPNumInstRemoved  ,
"Number of instructions removed by IPSCCP"   
)

◆ STATISTIC() [5/7]

STATISTIC ( IPNumArgsElimed  ,
"Number of arguments constant propagated by IPSCCP"   
)

◆ STATISTIC() [6/7]

STATISTIC ( IPNumGlobalConst  ,
"Number of globals found to be constant by IPSCCP"   
)

◆ STATISTIC() [7/7]

STATISTIC ( IPNumInstReplaced  ,
"Number of instructions replaced with (simpler) instruction by IPSCCP"   
)

◆ tryToReplaceWithConstant()

static bool tryToReplaceWithConstant ( SCCPSolver &  Solver,
Value V 
)
static

Variable Documentation

◆ false

Sparse Conditional Constant false

Definition at line 1812 of file SCCP.cpp.

◆ MaxNumRangeExtensions

const unsigned MaxNumRangeExtensions = 10
static

Definition at line 85 of file SCCP.cpp.

Referenced by getMaxWidenStepsOpts().

◆ Propagation

Sparse Conditional Constant Propagation

Definition at line 1812 of file SCCP.cpp.

◆ sccp

sccp

Definition at line 1812 of file SCCP.cpp.