39 #define DEBUG_TYPE "inline" 43 cl::desc(
"Cost of alloca argument"));
50 cl::desc(
"Maximum alloca size to use for inline cost"));
55 cl::desc(
"Maximum BB number allowed in a function after inlining" 56 " (compile time constraint)"));
70 unsigned getInlineThreshold(
CallSite CS)
const;
88 "AMDGPU Function Integration/Inlining",
false,
false)
100 TTIWP = &getAnalysis<TargetTransformInfoWrapperPass>();
104 void AMDGPUInliner::getAnalysisUsage(
AnalysisUsage &AU)
const {
109 unsigned AMDGPUInliner::getInlineThreshold(
CallSite CS)
const {
110 int Thres = Params.DefaultThreshold;
118 if (InlineHint && Params.HintThreshold && Params.HintThreshold > Thres
120 Thres = Params.HintThreshold.getValue() *
121 TTIWP->getTTI(*Callee).getInliningThresholdMultiplier();
125 return (
unsigned)Thres;
130 uint64_t AllocaSize = 0;
139 if (
const AllocaInst *AI = dyn_cast<AllocaInst>(PtrArg)) {
140 if (!AI->isStaticAlloca() || !AIVisited.
insert(AI).second)
154 return (
unsigned)Thres;
161 if (!Callee || Callee->
size() != 1)
165 if (!isa<CallInst>(
I)) {
168 if (isa<ReturnInst>(*std::next(
I->getIterator()))) {
191 if (CS.
hasFnAttr(Attribute::AlwaysInline)) {
203 bool RemarksEnabled =
false;
208 RemarksEnabled =
true;
212 std::function<AssumptionCache &(Function &)> GetAssumptionCache =
214 return ACT->getAssumptionCache(
F);
218 LocalParams, TTI, GetAssumptionCache,
None, PSI,
219 RemarksEnabled ? &ORE :
nullptr);
221 if (IC && !IC.isAlways() && !Callee->
hasFnAttribute(Attribute::InlineHint)) {
Pass interface - Implemented by all 'passes'.
A parsed version of the target data layout string in and methods for querying it. ...
Thresholds to tune inline cost analysis.
InlineCost getInlineCost(CallBase &Call, const InlineParams &Params, TargetTransformInfo &CalleeTTI, std::function< AssumptionCache &(Function &)> &GetAssumptionCache, Optional< function_ref< BlockFrequencyInfo &(Function &)>> GetBFI, ProfileSummaryInfo *PSI, OptimizationRemarkEmitter *ORE=nullptr)
Get an InlineCost object representing the cost of inlining this callsite.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of @llvm.assume calls within a function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
static bool isWrapperOnlyCall(CallSite CS)
Address space for flat memory.
Represents the cost of inlining a function.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
bool runOnSCC(CallGraphSCC &SCC) override
Main run interface method, this implements the interface required by the Pass class.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Pass * createAMDGPUFunctionInliningPass()
This class contains all of the helper code which is used to perform the inlining operations that do n...
amdgpu AMDGPU Function Integration Inlining
void initializeAMDGPUInlinerPass(PassRegistry &)
InstrTy * getInstruction() const
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
static cl::opt< unsigned > ArgAllocaCutoff("amdgpu-inline-arg-alloca-cutoff", cl::Hidden, cl::init(256), cl::desc("Maximum alloca size to use for inline cost"))
static InlineCost getAlways(const char *Reason)
Class to represent pointers.
const BasicBlock & getEntryBlock() const
initializer< Ty > init(const Ty &Val)
void getAnalysisUsage(AnalysisUsage &Info) const override
For this class, we declare that we require and preserve the call graph.
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
The ModulePass which wraps up a CallGraph and the logic to build it.
bool isNoInline() const
Return true if the call should not be inlined.
LLVM Basic Block Representation.
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Represent the analysis usage information of a pass.
InlineResult isInlineViable(Function &Callee)
Minimal filter to detect invalid constructs for inlining.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
This method strips off any GEP address adjustments and pointer casts from the specified value...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
iterator_range< IterTy > args() const
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options...
Module.h This file contains the declarations for the Module class.
static cl::opt< int > ArgAllocaCost("amdgpu-inline-arg-alloca-cost", cl::Hidden, cl::init(4000), cl::desc("Cost of alloca argument"))
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if this function has the given attribute.
amdgpu Simplify well known AMD library false FunctionCallee Callee
static InlineCost getNever(const char *Reason)
StringRef getName() const
Return a constant reference to the value's name.
static cl::opt< size_t > MaxBB("amdgpu-inline-max-bb", cl::Hidden, cl::init(1100), cl::desc("Maximum BB number allowed in a function after inlining" " (compile time constraint)"))
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
Address space for private memory.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Module * getParent()
Get the module that this global value is contained inside of...
INITIALIZE_PASS_BEGIN(AMDGPUInliner, "amdgpu-inline", "AMDGPU Function Integration/Inlining", false, false) INITIALIZE_PASS_END(AMDGPUInliner
LLVM Value Representation.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
int DefaultThreshold
The default threshold to start with for a callee.
an instruction to allocate memory on the stack
FunTy * getCaller() const
Return the caller function for this call site.