33 #define DEBUG_TYPE "inline" 45 for (
User *U :
F.users())
47 if (CS.getCalledFunction() == &
F)
72 M.getFunctionList().erase(F);
73 InlinedFunctions.
erase(NonComdatBegin, InlinedFunctions.
end());
75 if (!InlinedFunctions.
empty()) {
81 M.getFunctionList().erase(F);
100 AlwaysInlinerLegacyPass(
bool InsertLifetime)
106 bool runOnSCC(
CallGraphSCC &SCC)
override {
return inlineCalls(SCC); }
113 bool doFinalization(
CallGraph &CG)
override {
114 return removeDeadFunctions(CG,
true);
121 "Inliner for always_inline functions",
false,
false)
130 return new AlwaysInlinerLegacyPass(InsertLifetime);
Pass interface - Implemented by all 'passes'.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
INITIALIZE_PASS_BEGIN(AlwaysInlinerLegacyPass, "always-inline", "Inliner for always_inline functions", false, false) INITIALIZE_PASS_END(AlwaysInlinerLegacyPass
void push_back(const T &Elt)
An immutable pass that tracks lazily created AssumptionCache objects.
InlineResult InlineFunction(CallInst *C, InlineFunctionInfo &IFI, AAResults *CalleeAAR=nullptr, bool InsertLifetime=true)
This function inlines the called function into the basic block of the caller.
This class captures the data input to the InlineFunction call, and records the auxiliary results prod...
Represents the cost of inlining a function.
#define INITIALIZE_PASS_DEPENDENCY(depName)
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
This class contains all of the helper code which is used to perform the inlining operations that do n...
bool isInlineViable(Function &Callee)
Minimal filter to detect invalid constructs for inlining.
virtual bool doFinalization(Module &)
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
always Inliner for always_inline functions
bool insert(const value_type &X)
Insert a new element into the SetVector.
auto partition(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly...
static InlineCost getAlways(const char *Reason)
amdgpu Simplify well known AMD library false Value * Callee
void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
A set of analyses that are preserved following a run of a transformation pass.
The ModulePass which wraps up a CallGraph and the logic to build it.
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if this function has the given attribute.
Pass * createAlwaysInlinerLegacyPass(bool InsertLifetime=true)
Create a legacy pass manager instance of a pass to inline and remove functions marked as "always_inli...
void initializeAlwaysInlinerLegacyPassPass(PassRegistry &)
iterator erase(const_iterator CI)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
InlineCost getInlineCost(CallSite CS, 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.
Provides passes to inlining "always_inline" functions.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
A SetVector that performs no allocations if smaller than a certain size.
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.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
void clear()
Completely clear the SetVector.
void filterDeadComdatFunctions(Module &M, SmallVectorImpl< Function *> &DeadComdatFunctions)
Filter out potentially dead comdat functions where other entries keep the entire comdat group alive...
The basic data container for the call graph of a Module of IR.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
static InlineCost getNever(const char *Reason)
LLVM_NODISCARD bool empty() const
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
A container for analyses that lazily runs them and caches their results.
for(unsigned i=Desc.getNumOperands(), e=OldMI.getNumOperands();i !=e;++i)
bool isDefTriviallyDead() const
isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the ...