37 #define DEBUG_TYPE "partial-inlining"
40 "Number of callsites functions partially inlined into.");
54 cl::desc(
"Max Number of Blocks To be Partially Inlined"));
60 cl::desc(
"Max number of partial inlining. The default is unlimited"));
68 cl::desc(
"Relative frequency of outline region to "
73 cl::desc(
"A debug option to add additional penalty to the computed one."));
77 struct FunctionOutliningInfo {
78 FunctionOutliningInfo()
79 : Entries(), ReturnBlock(nullptr), NonReturnBlock(nullptr),
83 unsigned GetNumInlinedBlocks()
const {
return Entries.size() + 1; }
96 struct PartialInlinerImpl {
102 : GetAssumptionCache(GetAC), GetTTI(GTTI), GetBFI(GBFI), PSI(ProfSI) {}
110 struct FunctionCloner {
111 FunctionCloner(
Function *
F, FunctionOutliningInfo *OI);
117 void NormalizeReturnBlock();
128 bool IsFunctionInlined =
false;
130 int OutlinedRegionCost = 0;
131 std::unique_ptr<FunctionOutliningInfo> ClonedOI =
nullptr;
132 std::unique_ptr<BlockFrequencyInfo> ClonedFuncBFI =
nullptr;
136 int NumPartialInlining = 0;
137 std::function<AssumptionCache &(Function &)> *GetAssumptionCache;
138 std::function<TargetTransformInfo &(Function &)> *GetTTI;
150 bool shouldPartialInline(
CallSite CS, FunctionCloner &Cloner,
157 bool tryPartialInline(FunctionCloner &Cloner);
161 void computeCallsiteToProfCountMap(
Function *DuplicateFunction,
164 bool IsLimitReached() {
171 if (
CallInst *CI = dyn_cast<CallInst>(U))
173 else if (
InvokeInst *II = dyn_cast<InvokeInst>(U))
182 return getCallSite(User);
185 std::tuple<DebugLoc, BasicBlock *> getOneDebugLoc(
Function *F) {
189 return std::make_tuple(DLoc, Block);
198 std::tuple<int, int> computeOutliningCosts(FunctionCloner &Cloner);
202 static int computeBBInlineCost(
BasicBlock *BB);
204 std::unique_ptr<FunctionOutliningInfo> computeOutliningInfo(
Function *F);
208 struct PartialInlinerLegacyPass :
public ModulePass {
219 bool runOnModule(
Module &M)
override {
225 &getAnalysis<TargetTransformInfoWrapperPass>();
227 getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
229 std::function<AssumptionCache &(Function &)> GetAssumptionCache =
234 std::function<TargetTransformInfo &(Function &)> GetTTI =
236 return TTIWP->getTTI(F);
239 return PartialInlinerImpl(&GetAssumptionCache, &GetTTI,
None, PSI).run(M);
244 std::unique_ptr<FunctionOutliningInfo>
245 PartialInlinerImpl::computeOutliningInfo(
Function *F) {
249 return std::unique_ptr<FunctionOutliningInfo>();
262 return isa<ReturnInst>(TI);
266 if (IsReturnBlock(Succ1))
267 return std::make_tuple(Succ1, Succ2);
268 if (IsReturnBlock(Succ2))
269 return std::make_tuple(Succ2, Succ1);
271 return std::make_tuple<BasicBlock *, BasicBlock *>(
nullptr,
nullptr);
276 if (IsSuccessor(Succ1, Succ2))
277 return std::make_tuple(Succ1, Succ2);
278 if (IsSuccessor(Succ2, Succ1))
279 return std::make_tuple(Succ2, Succ1);
281 return std::make_tuple<BasicBlock *, BasicBlock *>(
nullptr,
nullptr);
284 std::unique_ptr<FunctionOutliningInfo> OutliningInfo =
285 llvm::make_unique<FunctionOutliningInfo>();
288 bool CandidateFound =
false;
296 if (SuccSize(CurrEntry) != 2)
303 std::tie(ReturnBlock, NonReturnBlock) = GetReturnBlock(Succ1, Succ2);
306 OutliningInfo->Entries.push_back(CurrEntry);
307 OutliningInfo->ReturnBlock = ReturnBlock;
308 OutliningInfo->NonReturnBlock = NonReturnBlock;
309 CandidateFound =
true;
315 std::tie(CommSucc, OtherSucc) = GetCommonSucc(Succ1, Succ2);
320 OutliningInfo->Entries.push_back(CurrEntry);
326 return std::unique_ptr<FunctionOutliningInfo>();
332 "Function Entry must be the first in Entries vector");
339 auto HasNonEntryPred = [Entries](
BasicBlock *BB) {
341 if (!Entries.count(Pred))
346 auto CheckAndNormalizeCandidate =
347 [Entries, HasNonEntryPred](FunctionOutliningInfo *OutliningInfo) {
348 for (
BasicBlock *E : OutliningInfo->Entries) {
350 if (Entries.count(Succ))
352 if (Succ == OutliningInfo->ReturnBlock)
353 OutliningInfo->ReturnBlockPreds.push_back(E);
354 else if (Succ != OutliningInfo->NonReturnBlock)
358 if (HasNonEntryPred(E))
364 if (!CheckAndNormalizeCandidate(OutliningInfo.get()))
365 return std::unique_ptr<FunctionOutliningInfo>();
370 BasicBlock *Cand = OutliningInfo->NonReturnBlock;
371 if (SuccSize(Cand) != 2)
374 if (HasNonEntryPred(Cand))
381 std::tie(ReturnBlock, NonReturnBlock) = GetReturnBlock(Succ1, Succ2);
382 if (!ReturnBlock || ReturnBlock != OutliningInfo->ReturnBlock)
389 OutliningInfo->Entries.push_back(Cand);
390 OutliningInfo->NonReturnBlock = NonReturnBlock;
391 OutliningInfo->ReturnBlockPreds.push_back(Cand);
392 Entries.insert(Cand);
395 return OutliningInfo;
403 for (
auto *E : OI->Entries) {
415 PartialInlinerImpl::getOutliningCallBBRelativeFreq(FunctionCloner &Cloner) {
418 Cloner.ClonedFuncBFI->getBlockFreq(&Cloner.ClonedFunc->getEntryBlock());
419 auto OutliningCallFreq =
420 Cloner.ClonedFuncBFI->getBlockFreq(Cloner.OutliningCallBB);
422 auto OutlineRegionRelFreq =
424 EntryFreq.getFrequency());
427 return OutlineRegionRelFreq;
442 return OutlineRegionRelFreq;
447 return OutlineRegionRelFreq;
450 bool PartialInlinerImpl::shouldPartialInline(
460 assert(Callee == Cloner.ClonedFunc);
463 auto &CalleeTTI = (*GetTTI)(*Callee);
465 *GetAssumptionCache, GetBFI, PSI);
469 <<
NV(
"Callee", Cloner.OrigFunc)
470 <<
" should always be fully inlined, not partially");
476 <<
NV(
"Callee", Cloner.OrigFunc) <<
" not partially inlined into "
477 <<
NV(
"Caller", Caller)
478 <<
" because it should never be inlined (cost=never)");
484 <<
NV(
"Callee", Cloner.OrigFunc) <<
" not partially inlined into "
485 <<
NV(
"Caller", Caller) <<
" because too costly to inline (cost="
486 <<
NV(
"Cost", IC.getCost()) <<
", threshold="
487 <<
NV(
"Threshold", IC.getCostDelta() + IC.getCost()) <<
")");
490 const DataLayout &
DL = Caller->getParent()->getDataLayout();
497 if (NormWeightedSavings < WeightedOutliningRcost) {
500 <<
NV(
"Callee", Cloner.OrigFunc) <<
" not partially inlined into "
501 <<
NV(
"Caller", Caller) <<
" runtime overhead (overhead="
502 <<
NV(
"Overhead", (
unsigned)WeightedOutliningRcost.
getFrequency())
504 <<
NV(
"Savings", (
unsigned)NormWeightedSavings.getFrequency()) <<
")"
505 <<
" of making the outlined call is too high");
511 <<
NV(
"Callee", Cloner.OrigFunc) <<
" can be partially inlined into "
512 <<
NV(
"Caller", Caller) <<
" with cost=" <<
NV(
"Cost", IC.getCost())
514 <<
NV(
"Threshold", IC.getCostDelta() + IC.getCost()) <<
")");
521 int PartialInlinerImpl::computeBBInlineCost(
BasicBlock *BB) {
525 if (isa<DbgInfoIntrinsic>(
I))
528 switch (
I->getOpcode()) {
529 case Instruction::BitCast:
530 case Instruction::PtrToInt:
531 case Instruction::IntToPtr:
532 case Instruction::Alloca:
534 case Instruction::GetElementPtr:
535 if (cast<GetElementPtrInst>(
I)->hasAllZeroIndices())
548 if (
CallInst *CI = dyn_cast<CallInst>(
I)) {
568 PartialInlinerImpl::computeOutliningCosts(FunctionCloner &Cloner) {
572 int OutliningFuncCallCost = computeBBInlineCost(Cloner.OutliningCallBB);
575 int OutlinedFunctionCost = 0;
577 OutlinedFunctionCost += computeBBInlineCost(&BB);
580 assert(OutlinedFunctionCost >= Cloner.OutlinedRegionCost &&
581 "Outlined function cost should be no less than the outlined region");
587 int OutliningRuntimeOverhead =
588 OutliningFuncCallCost +
589 (OutlinedFunctionCost - Cloner.OutlinedRegionCost) +
592 return std::make_tuple(OutliningFuncCallCost, OutliningRuntimeOverhead);
598 void PartialInlinerImpl::computeCallsiteToProfCountMap(
604 std::unique_ptr<BlockFrequencyInfo> TempBFI;
607 auto ComputeCurrBFI = [&,
this](
Function *Caller) {
614 CurrentCallerBFI = TempBFI.get();
617 CurrentCallerBFI = &(*GetBFI)(*Caller);
621 for (User *User :
Users) {
624 if (CurrentCaller != Caller) {
625 CurrentCaller = Caller;
626 ComputeCurrBFI(Caller);
628 assert(CurrentCallerBFI &&
"CallerBFI is not set");
633 CallSiteToProfCountMap[User] = *Count;
635 CallSiteToProfCountMap[User] = 0;
639 PartialInlinerImpl::FunctionCloner::FunctionCloner(
Function *F,
640 FunctionOutliningInfo *OI)
642 ClonedOI = llvm::make_unique<FunctionOutliningInfo>();
648 ClonedOI->ReturnBlock = cast<BasicBlock>(VMap[OI->ReturnBlock]);
649 ClonedOI->NonReturnBlock = cast<BasicBlock>(VMap[OI->NonReturnBlock]);
651 ClonedOI->Entries.push_back(cast<BasicBlock>(VMap[BB]));
655 ClonedOI->ReturnBlockPreds.push_back(NewE);
662 void PartialInlinerImpl::FunctionCloner::NormalizeReturnBlock() {
667 while (I != BB->
end()) {
683 BasicBlock *PreReturn = ClonedOI->ReturnBlock;
685 PHINode *FirstPhi = getFirstPHI(PreReturn);
686 unsigned NumPredsFromEntries = ClonedOI->ReturnBlockPreds.size();
692 Value *CommonValue = PN->getIncomingValue(0);
693 if (
all_of(PN->incoming_values(),
694 [&](
Value *V) {
return V == CommonValue; }))
699 ClonedOI->ReturnBlock = ClonedOI->ReturnBlock->splitBasicBlock(
700 ClonedOI->ReturnBlock->getFirstNonPHI()->getIterator());
704 while (I != PreReturn->
end()) {
710 PHINode::Create(OldPhi->
getType(), NumPredsFromEntries + 1,
"",
Ins);
712 Ins = ClonedOI->ReturnBlock->getFirstNonPHI();
715 for (
BasicBlock *E : ClonedOI->ReturnBlockPreds) {
724 if (
auto *OldPhiVal = IsTrivialPhi(OldPhi)) {
730 for (
auto *DP : DeadPhis)
731 DP->eraseFromParent();
733 for (
auto E : ClonedOI->ReturnBlockPreds) {
738 Function *PartialInlinerImpl::FunctionCloner::doFunctionOutlining() {
741 auto ToBeInlined = [&,
this](
BasicBlock *BB) {
742 return BB == ClonedOI->ReturnBlock ||
743 (
std::find(ClonedOI->Entries.begin(), ClonedOI->Entries.end(), BB) !=
744 ClonedOI->Entries.end());
748 std::vector<BasicBlock *> ToExtract;
749 ToExtract.push_back(ClonedOI->NonReturnBlock);
750 OutlinedRegionCost +=
751 PartialInlinerImpl::computeBBInlineCost(ClonedOI->NonReturnBlock);
753 if (!ToBeInlined(&BB) && &BB != ClonedOI->NonReturnBlock) {
754 ToExtract.push_back(&BB);
759 OutlinedRegionCost += computeBBInlineCost(&BB);
773 ClonedFuncBFI.get(), &BPI)
774 .extractCodeRegion();
777 OutliningCallBB = PartialInlinerImpl::getOneCallSiteTo(OutlinedFunc)
780 assert(OutliningCallBB->getParent() == ClonedFunc);
786 PartialInlinerImpl::FunctionCloner::~FunctionCloner() {
789 ClonedFunc->replaceAllUsesWith(OrigFunc);
790 ClonedFunc->eraseFromParent();
791 if (!IsFunctionInlined) {
795 OutlinedFunc->eraseFromParent();
811 if (PSI->isFunctionEntryCold(F))
817 std::unique_ptr<FunctionOutliningInfo> OI = computeOutliningInfo(F);
822 FunctionCloner Cloner(F, OI.get());
823 Cloner.NormalizeReturnBlock();
824 Function *OutlinedFunction = Cloner.doFunctionOutlining();
826 bool AnyInline = tryPartialInline(Cloner);
829 return OutlinedFunction;
834 bool PartialInlinerImpl::tryPartialInline(FunctionCloner &Cloner) {
835 int NonWeightedRcost;
838 if (Cloner.OutlinedFunc ==
nullptr)
841 std::tie(SizeCost, NonWeightedRcost) = computeOutliningCosts(Cloner);
843 auto RelativeToEntryFreq = getOutliningCallBBRelativeFreq(Cloner);
844 auto WeightedRcost =
BlockFrequency(NonWeightedRcost) * RelativeToEntryFreq;
854 std::tie(DLoc, Block) = getOneDebugLoc(Cloner.ClonedFunc);
857 <<
ore::NV(
"Function", Cloner.OrigFunc)
858 <<
" not partially inlined into callers (Original Size = "
859 <<
ore::NV(
"OutlinedRegionOriginalSize", Cloner.OutlinedRegionCost)
860 <<
", Size of call sequence to outlined function = "
861 <<
ore::NV(
"NewSize", SizeCost) <<
")");
865 assert(Cloner.OrigFunc->user_begin() == Cloner.OrigFunc->user_end() &&
866 "F's users should all be replaced!");
868 std::vector<User *>
Users(Cloner.ClonedFunc->user_begin(),
869 Cloner.ClonedFunc->user_end());
872 if (Cloner.OrigFunc->getEntryCount())
873 computeCallsiteToProfCountMap(Cloner.ClonedFunc, CallSiteToProfCountMap);
875 auto CalleeEntryCount = Cloner.OrigFunc->getEntryCount();
876 uint64_t CalleeEntryCountV = (CalleeEntryCount ? *CalleeEntryCount : 0);
878 bool AnyInline =
false;
879 for (User *User : Users) {
882 if (IsLimitReached())
887 if (!shouldPartialInline(CS, Cloner, WeightedRcost, ORE))
892 <<
ore::NV(
"Callee", Cloner.OrigFunc) <<
" partially inlined into "
899 if (CalleeEntryCountV && CallSiteToProfCountMap.count(User)) {
900 uint64_t CallSiteCount = CallSiteToProfCountMap[User];
901 CalleeEntryCountV -=
std::min(CalleeEntryCountV, CallSiteCount);
905 NumPartialInlining++;
911 Cloner.IsFunctionInlined =
true;
912 if (CalleeEntryCount)
913 Cloner.OrigFunc->setEntryCount(CalleeEntryCountV);
919 bool PartialInlinerImpl::run(
Module &M) {
923 std::vector<Function *> Worklist;
924 Worklist.reserve(M.
size());
927 Worklist.push_back(&F);
929 bool Changed =
false;
930 while (!Worklist.empty()) {
937 bool Recursive =
false;
938 for (User *U : CurrFunc->
users())
940 if (I->getParent()->getParent() == CurrFunc) {
947 if (
Function *NewFunc = unswitchFunction(CurrFunc)) {
948 Worklist.push_back(NewFunc);
958 "Partial Inliner",
false,
false)
966 return new PartialInlinerLegacyPass();
973 std::function<AssumptionCache &(Function &)> GetAssumptionCache =
978 std::function<BlockFrequencyInfo &(Function &)> GetBFI =
983 std::function<TargetTransformInfo &(Function &)> GetTTI =
990 if (PartialInlinerImpl(&GetAssumptionCache, &GetTTI, {GetBFI}, PSI).
run(M))
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
FunTy * getCaller() const
Return the caller function for this call site.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
DiagnosticInfoOptimizationBase::Argument NV
STATISTIC(NumFunctions,"Total number of functions")
void initializePartialInlinerLegacyPassPass(PassRegistry &)
A Module instance is used to store all the information related to an LLVM module. ...
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
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"))
Implements a dense probed hash-table based set.
Analysis providing profile information.
BBTy * getParent() const
Get the basic block containing the call site.
This class represents a function call, abstracting a target machine's calling convention.
Function * CloneFunction(Function *F, ValueToValueMapTy &VMap, ClonedCodeInfo *CodeInfo=nullptr)
CloneFunction - Return a copy of the specified function and add it to that function's module...
An immutable pass that tracks lazily created AssumptionCache objects.
An efficient, type-erasing, non-owning reference to a callable.
A cache of .assume calls within a function.
Analysis pass providing the TargetTransformInfo.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
const Function * getParent() const
Return the enclosing method, or null if none.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
iv Induction Variable Users
InlineFunctionInfo - This class captures the data input to the InlineFunction call, and records the auxiliary results produced by it.
Represents the cost of inlining a function.
iterator begin()
Instruction iterator methods.
bool InlineFunction(CallInst *C, InlineFunctionInfo &IFI, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true)
InlineFunction - This function inlines the called function into the basic block of the caller...
AnalysisUsage & addRequired()
ModulePass * createPartialInliningPass()
createPartialInliningPass - This pass inlines parts of functions.
#define INITIALIZE_PASS_DEPENDENCY(depName)
bool isUnconditional() const
Value * removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty=true)
Remove an incoming value.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
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"))
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
static cl::opt< unsigned > MaxNumInlineBlocks("max-num-inline-blocks", cl::init(5), cl::Hidden, cl::desc("Max Number of Blocks To be Partially Inlined"))
static cl::opt< bool > SkipCostAnalysis("skip-partial-inlining-cost-analysis", cl::init(false), cl::ZeroOrMore, cl::ReallyHidden, cl::desc("Skip Cost Analysis"))
const BasicBlock & back() const
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Optional< uint64_t > getEntryCount() const
Get the entry count for this function.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
Interval::succ_iterator succ_end(Interval *I)
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
static 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."))
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
initializer< Ty > init(const Ty &Val)
Control flow instructions. These all have token chains.
Subclasses of this class are all able to terminate a basic block.
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
An analysis pass based on the new PM to deliver ProfileSummaryInfo.
std::pair< iterator, bool > insert(const ValueT &V)
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
bool extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const
Retrieve the raw weight values of a conditional branch or select.
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
Used in the streaming interface as the general argument type.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
A function analysis which provides an AssumptionCache.
Analysis pass which computes BlockFrequencyInfo.
InlineCost getInlineCost(CallSite CS, const InlineParams &Params, TargetTransformInfo &CalleeTTI, std::function< AssumptionCache &(Function &)> &GetAssumptionCache, Optional< function_ref< BlockFrequencyInfo &(Function &)>> GetBFI, ProfileSummaryInfo *PSI)
Get an InlineCost object representing the cost of inlining this callsite.
Iterator for intrusive lists based on ilist_node.
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
InstrTy * getInstruction() const
InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
static BranchProbability getBranchProbability(uint64_t Numerator, uint64_t Denominator)
pred_range predecessors(BasicBlock *BB)
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
iterator_range< user_iterator > users()
llvm_unreachable("Unknown RegBank!")
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Analysis providing branch probability information.
bool hasAddressTaken(const User **=nullptr) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
int getCallsiteCost(CallSite CS, const DataLayout &DL)
Return the cost associated with a callsite, including parameter passing and the call/return instructi...
static bool hasProfileData(Function *F, FunctionOutliningInfo *OI)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
const BasicBlock & front() const
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
succ_range successors(BasicBlock *BB)
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
AssumptionCache & getAssumptionCache(Function &F)
Get the cached assumptions for a function.
print Print MemDeps of function
A container for analyses that lazily runs them and caches their results.
static MachineBasicBlock * OtherSucc(MachineBasicBlock *MBB, MachineBasicBlock *Succ)
Optional< uint64_t > getBlockProfileCount(const BasicBlock *BB) const
Returns the estimated profile count of BB.
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static cl::opt< bool > DisablePartialInlining("disable-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Disable partial ininling"))
const BasicBlock * getParent() const
A wrapper class for inspecting calls to intrinsic functions.
INITIALIZE_PASS_BEGIN(PartialInlinerLegacyPass,"partial-inliner","Partial Inliner", false, false) INITIALIZE_PASS_END(PartialInlinerLegacyPass
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.