LLVM  8.0.1
Macros | Functions | Variables
PartialInlining.cpp File Reference
#include "llvm/Transforms/IPO/PartialInlining.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.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/Module.h"
#include "llvm/IR/User.h"
#include "llvm/Pass.h"
#include "llvm/Support/BlockFrequency.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/CodeExtractor.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <functional>
#include <iterator>
#include <memory>
#include <tuple>
#include <vector>
Include dependency graph for PartialInlining.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "partial-inlining"
 

Functions

 STATISTIC (NumPartialInlined, "Number of callsites functions partially inlined into.")
 
 STATISTIC (NumColdOutlinePartialInlined, "Number of times functions with " "cold outlined regions were partially " "inlined into its caller(s).")
 
 STATISTIC (NumColdRegionsFound, "Number of cold single entry/exit regions found.")
 
 STATISTIC (NumColdRegionsOutlined, "Number of cold single entry/exit regions outlined.")
 
static bool hasProfileData (Function *F, FunctionOutliningInfo *OI)
 
 INITIALIZE_PASS_BEGIN (PartialInlinerLegacyPass, "partial-inliner", "Partial Inliner", false, false) INITIALIZE_PASS_END(PartialInlinerLegacyPass
 

Variables

static cl::opt< boolDisablePartialInlining ("disable-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Disable partial inlining"))
 
static cl::opt< boolDisableMultiRegionPartialInline ("disable-mr-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Disable multi-region partial inlining"))
 
static cl::opt< boolForceLiveExit ("pi-force-live-exit-outline", cl::init(false), cl::Hidden, cl::desc("Force outline regions with live exits"))
 
static cl::opt< boolMarkOutlinedColdCC ("pi-mark-coldcc", cl::init(false), cl::Hidden, cl::desc("Mark outline function calls with ColdCC"))
 
static cl::opt< boolTracePartialInlining ("trace-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Trace partial inlining."))
 
static cl::opt< boolSkipCostAnalysis ("skip-partial-inlining-cost-analysis", cl::init(false), cl::ZeroOrMore, cl::ReallyHidden, cl::desc("Skip Cost Analysis"))
 
static cl::opt< float > MinRegionSizeRatio ("min-region-size-ratio", cl::init(0.1), cl::Hidden, cl::desc("Minimum ratio comparing relative sizes of each " "outline candidate and original function"))
 
static cl::opt< unsignedMinBlockCounterExecution ("min-block-execution", cl::init(100), cl::Hidden, cl::desc("Minimum block executions to consider " "its BranchProbabilityInfo valid"))
 
static cl::opt< float > ColdBranchRatio ("cold-branch-ratio", cl::init(0.1), cl::Hidden, cl::desc("Minimum BranchProbability to consider a region cold."))
 
static cl::opt< unsignedMaxNumInlineBlocks ("max-num-inline-blocks", cl::init(5), cl::Hidden, cl::desc("Max number of blocks to be partially inlined"))
 
static cl::opt< int > MaxNumPartialInlining ("max-partial-inlining", cl::init(-1), cl::Hidden, cl::ZeroOrMore, cl::desc("Max number of partial inlining. The default is unlimited"))
 
static cl::opt< int > OutlineRegionFreqPercent ("outline-region-freq-percent", cl::init(75), cl::Hidden, cl::ZeroOrMore, cl::desc("Relative frequency of outline region to " "the entry block"))
 
static cl::opt< unsignedExtraOutliningPenalty ("partial-inlining-extra-penalty", cl::init(0), cl::Hidden, cl::desc("A debug option to add additional penalty to the computed one."))
 
partial inliner
 
partial Partial Inliner
 
partial Partial false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "partial-inlining"

Definition at line 67 of file PartialInlining.cpp.

Referenced by hasProfileData().

Function Documentation

◆ hasProfileData()

static bool hasProfileData ( Function F,
FunctionOutliningInfo *  OI 
)
static

Definition at line 696 of file PartialInlining.cpp.

References llvm::PHINode::addIncoming(), llvm::all_of(), llvm::Attribute::AlwaysInline, assert(), llvm::Function::back(), llvm::BasicBlock::begin(), Callee, llvm::CloneFunction(), llvm::CallingConv::Cold, llvm::PHINode::Create(), llvm::dbgs(), DEBUG_TYPE, DisableMultiRegionPartialInline, DisablePartialInlining, llvm::dyn_cast(), E, llvm::OptimizationRemarkEmitter::emit(), llvm::empty(), llvm::BasicBlock::end(), llvm::Function::eraseFromParent(), llvm::Instruction::extractProfMetadata(), ExtraOutliningPenalty, F(), llvm::find(), ForceLiveExit, llvm::BlockFrequencyInfo::getBlockProfileCount(), llvm::BranchProbability::getBranchProbability(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCaller(), llvm::getCallsiteCost(), llvm::InlineCost::getCost(), llvm::InlineCost::getCostDelta(), llvm::Module::getDataLayout(), llvm::BlockFrequency::getFrequency(), llvm::PHINode::getIncomingValueForBlock(), llvm::getInlineCost(), llvm::getInlineParams(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::Function::hasAddressTaken(), llvm::Function::hasFnAttribute(), llvm::Function::hasProfileData(), I, INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY, llvm::InlineFunction(), llvm::MipsISD::Ins, llvm::InlineConstants::InstrCost, llvm::BasicBlock::instructionsWithoutDebug(), llvm::InlineCost::isAlways(), llvm::GlobalValue::isDeclaration(), llvm::isInlineViable(), llvm::InlineCost::isNever(), llvm::BranchInst::isUnconditional(), MarkOutlinedColdCC, llvm::max(), llvm::Attribute::NoInline, OR, OutlineRegionFreqPercent, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate(), llvm::PHINode::removeIncomingValue(), llvm::Value::replaceAllUsesWith(), llvm::User::replaceUsesOfWith(), llvm::Function::setCallingConv(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setCallingConv(), llvm::SetVector< T, Vector, Set >::size(), llvm::Module::size(), SkipCostAnalysis, T, TracePartialInlining, llvm::Value::use_empty(), llvm::Value::user_begin(), llvm::Value::user_end(), Users, and llvm::Value::users().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( PartialInlinerLegacyPass  ,
"partial-inliner ,
"Partial Inliner ,
false  ,
false   
)

Referenced by hasProfileData().

◆ STATISTIC() [1/4]

STATISTIC ( NumPartialInlined  ,
"Number of callsites functions partially inlined into."   
)

◆ STATISTIC() [2/4]

STATISTIC ( NumColdOutlinePartialInlined  ,
"Number of times functions with " "cold outlined regions were partially " "inlined into its caller(s)."   
)

◆ STATISTIC() [3/4]

STATISTIC ( NumColdRegionsFound  ,
"Number of cold single entry/exit regions found."   
)

◆ STATISTIC() [4/4]

STATISTIC ( NumColdRegionsOutlined  ,
"Number of cold single entry/exit regions outlined."   
)

Variable Documentation

◆ ColdBranchRatio

cl::opt<float> ColdBranchRatio("cold-branch-ratio", cl::init(0.1), cl::Hidden, cl::desc("Minimum BranchProbability to consider a region cold."))
static

◆ DisableMultiRegionPartialInline

cl::opt<bool> DisableMultiRegionPartialInline("disable-mr-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Disable multi-region partial inlining"))
static

Referenced by hasProfileData().

◆ DisablePartialInlining

cl::opt<bool> DisablePartialInlining("disable-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Disable partial inlining"))
static

Referenced by hasProfileData().

◆ ExtraOutliningPenalty

cl::opt<unsigned> ExtraOutliningPenalty("partial-inlining-extra-penalty", cl::init(0), cl::Hidden, cl::desc("A debug option to add additional penalty to the computed one."))
static

Referenced by hasProfileData().

◆ false

partial Partial false

Definition at line 1472 of file PartialInlining.cpp.

◆ ForceLiveExit

cl::opt<bool> ForceLiveExit("pi-force-live-exit-outline", cl::init(false), cl::Hidden, cl::desc("Force outline regions with live exits"))
static

Referenced by hasProfileData().

◆ inliner

partial inliner

Definition at line 1472 of file PartialInlining.cpp.

◆ Inliner

partial Partial Inliner

◆ MarkOutlinedColdCC

cl::opt<bool> MarkOutlinedColdCC("pi-mark-coldcc", cl::init(false), cl::Hidden, cl::desc("Mark outline function calls with ColdCC"))
static

Referenced by hasProfileData().

◆ MaxNumInlineBlocks

cl::opt<unsigned> MaxNumInlineBlocks("max-num-inline-blocks", cl::init(5), cl::Hidden, cl::desc("Max number of blocks to be partially inlined"))
static

◆ MaxNumPartialInlining

cl::opt<int> MaxNumPartialInlining("max-partial-inlining", cl::init(-1), cl::Hidden, cl::ZeroOrMore, cl::desc("Max number of partial inlining. The default is unlimited"))
static

◆ MinBlockCounterExecution

cl::opt<unsigned> MinBlockCounterExecution("min-block-execution", cl::init(100), cl::Hidden, cl::desc("Minimum block executions to consider " "its BranchProbabilityInfo valid"))
static

◆ MinRegionSizeRatio

cl::opt<float> MinRegionSizeRatio("min-region-size-ratio", cl::init(0.1), cl::Hidden, cl::desc("Minimum ratio comparing relative sizes of each " "outline candidate and original function"))
static

◆ OutlineRegionFreqPercent

cl::opt<int> OutlineRegionFreqPercent("outline-region-freq-percent", cl::init(75), cl::Hidden, cl::ZeroOrMore, cl::desc("Relative frequency of outline region to " "the entry block"))
static

Referenced by hasProfileData().

◆ SkipCostAnalysis

cl::opt<bool> SkipCostAnalysis("skip-partial-inlining-cost-analysis", cl::init(false), cl::ZeroOrMore, cl::ReallyHidden, cl::desc("Skip Cost Analysis"))
static

Referenced by hasProfileData().

◆ TracePartialInlining

cl::opt<bool> TracePartialInlining("trace-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Trace partial inlining."))
static

Referenced by hasProfileData().