LLVM 19.0.0git
Macros | Functions | Variables
SCCP.cpp File Reference
#include "llvm/Transforms/IPO/SCCP.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueLattice.h"
#include "llvm/Analysis/ValueLatticeUtils.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/FunctionSpecialization.h"
#include "llvm/Transforms/Scalar/SCCP.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SCCPSolver.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "sccp"
 

Functions

 STATISTIC (NumInstRemoved, "Number of instructions removed")
 
 STATISTIC (NumArgsElimed,"Number of arguments constant propagated")
 
 STATISTIC (NumGlobalConst, "Number of globals found to be constant")
 
 STATISTIC (NumDeadBlocks, "Number of basic blocks unreachable")
 
 STATISTIC (NumInstReplaced, "Number of instructions replaced with (simpler) instruction")
 
static void findReturnsToZap (Function &F, SmallVector< ReturnInst *, 8 > &ReturnsToZap, SCCPSolver &Solver)
 
static bool runIPSCCP (Module &M, const DataLayout &DL, FunctionAnalysisManager *FAM, std::function< const TargetLibraryInfo &(Function &)> GetTLI, std::function< TargetTransformInfo &(Function &)> GetTTI, std::function< AssumptionCache &(Function &)> GetAC, std::function< DominatorTree &(Function &)> GetDT, std::function< BlockFrequencyInfo &(Function &)> GetBFI, bool IsFuncSpecEnabled)
 

Variables

static cl::opt< unsignedFuncSpecMaxIters ("funcspec-max-iters", cl::init(10), cl::Hidden, cl::desc("The maximum number of iterations function specialization is run"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "sccp"

Definition at line 37 of file SCCP.cpp.

Function Documentation

◆ findReturnsToZap()

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

◆ runIPSCCP()

static bool runIPSCCP ( Module M,
const DataLayout DL,
FunctionAnalysisManager FAM,
std::function< const TargetLibraryInfo &(Function &)>  GetTLI,
std::function< TargetTransformInfo &(Function &)>  GetTTI,
std::function< AssumptionCache &(Function &)>  GetAC,
std::function< DominatorTree &(Function &)>  GetDT,
std::function< BlockFrequencyInfo &(Function &)>  GetBFI,
bool  IsFuncSpecEnabled 
)
static

Definition at line 110 of file SCCP.cpp.

References A, llvm::SCCPSolver::addArgumentTrackedFunction(), llvm::SCCPSolver::addPredicateInfo(), llvm::SCCPSolver::addTrackedFunction(), llvm::all_of(), llvm::CallBase::args(), assert(), llvm::canTrackArgumentsInterprocedurally(), llvm::canTrackGlobalVariableInterprocedurally(), llvm::canTrackReturnsInterprocedurally(), llvm::changeToUnreachable(), Context, llvm::dbgs(), DL, F, FAM, findReturnsToZap(), FuncSpecMaxIters, G, llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::CallBase::getArgOperandNo(), llvm::AnalysisManager< IRUnitT, ExtraArgTs >::getCachedResult(), llvm::ValueLatticeElement::getConstantRange(), llvm::GlobalVariable::getDebugInfo(), llvm::getExpressionForConstant(), llvm::GlobalVariable::getInitializer(), llvm::MemoryEffectsBase< LocationEnum >::getModRef(), llvm::SCCPSolver::getMRVFunctionsTracked(), llvm::Value::getName(), llvm::SCCPSolver::getPredicateInfoFor(), llvm::SCCPSolver::getTrackedGlobals(), llvm::SCCPSolver::getTrackedRetVals(), llvm::AttributeFuncs::getUBImplyingAttributes(), llvm::GlobalValue::getValueType(), llvm::Attribute::getWithMemoryEffects(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::SCCPSolver::isBlockExecutable(), llvm::SCCPSolver::isConstant(), llvm::ValueLatticeElement::isConstantRange(), llvm::ValueLatticeElement::isConstantRangeIncludingUndef(), llvm::SCCPSolver::isOverdefined(), llvm::ConstantRange::isSingleElement(), llvm::SCCPSolver::isStructLatticeConstant(), llvm::ValueLatticeElement::isUnknownOrUndef(), LLVM_DEBUG, llvm::make_early_inc_range(), llvm::SCCPSolver::markBlockExecutable(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::CallBase::removeParamAttr(), llvm::CallBase::removeRetAttrs(), llvm::FunctionSpecializer::run(), llvm::SCCPSolver::simplifyInstsInBlock(), llvm::SmallVectorBase< Size_T >::size(), llvm::SCCPSolver::solveWhileResolvedUndefsIn(), llvm::SCCPSolver::trackValueOfArgument(), llvm::SCCPSolver::trackValueOfGlobalVariable(), llvm::SCCPSolver::tryToReplaceWithConstant(), llvm::MemoryEffectsBase< LocationEnum >::unknown(), llvm::Value::use_empty(), and llvm::Value::user_back().

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

◆ STATISTIC() [1/5]

STATISTIC ( NumArgsElimed  ,
"Number of arguments constant propagated"   
)

◆ STATISTIC() [2/5]

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

◆ STATISTIC() [3/5]

STATISTIC ( NumGlobalConst  ,
"Number of globals found to be constant"   
)

◆ STATISTIC() [4/5]

STATISTIC ( NumInstRemoved  ,
"Number of instructions removed"   
)

◆ STATISTIC() [5/5]

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

Variable Documentation

◆ FuncSpecMaxIters

cl::opt< unsigned > FuncSpecMaxIters("funcspec-max-iters", cl::init(10), cl::Hidden, cl::desc( "The maximum number of iterations function specialization is run")) ( "funcspec-max-iters"  ,
cl::init(10)  ,
cl::Hidden  ,
cl::desc( "The maximum number of iterations function specialization is run")   
)
static

Referenced by runIPSCCP().