28 "amdgpu-stress-function-calls",
30 cl::desc(
"Force all functions to be noinline"),
39 AMDGPUAlwaysInline(
bool GlobalOpt =
false) :
51 "AMDGPU Inline All Functions",
false,
false)
53char AMDGPUAlwaysInline::
ID = 0;
62 while (!Stack.empty()) {
63 User *U = Stack.pop_back_val();
64 if (!Visited.
insert(U).second)
75 F->removeFnAttr(Attribute::NoInline);
77 FuncsToAlwaysInline.insert(
F);
90 std::vector<GlobalAlias*> AliasesToRemove;
95 Triple TT(M.getTargetTriple());
98 if (
Function*
F = dyn_cast<Function>(
A.getAliasee())) {
103 A.replaceAllUsesWith(
F);
104 AliasesToRemove.push_back(&
A);
113 A->eraseFromParent();
129 unsigned AS = GV.getAddressSpace();
138 = StressCalls ? Attribute::AlwaysInline : Attribute::NoInline;
141 if (!
F.isDeclaration() && !
F.use_empty() &&
142 !
F.hasFnAttribute(IncompatAttr)) {
144 if (!FuncsToAlwaysInline.
count(&
F))
147 FuncsToAlwaysInline.
insert(&
F);
153 F->addFnAttr(Attribute::AlwaysInline);
156 F->addFnAttr(Attribute::NoInline);
158 return Changed || !FuncsToAlwaysInline.
empty() || !FuncsToNoInline.
empty();
161bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
166 return new AMDGPUAlwaysInline(GlobalOpt);
static bool alwaysInlineImpl(Module &M, bool GlobalOpt)
static INITIALIZE_PASS(AMDGPUAlwaysInline, "amdgpu-always-inline", "AMDGPU Inline All Functions", false, false) char AMDGPUAlwaysInline void recursivelyVisitUsers(GlobalValue &GV, SmallPtrSetImpl< Function * > &FuncsToAlwaysInline)
The AMDGPU TargetMachine interface definition for hw codegen targets.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool EnableFunctionCalls
static bool EnableLowerModuleLDS
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
@ InternalLinkage
Rename collisions when linking (static functions).
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Triple - Helper class for working with autoconf configuration names.
@ REGION_ADDRESS
Address space for region memory. (GDS)
@ LOCAL_ADDRESS
Address space for local memory.
bool isEntryFunctionCC(CallingConv::ID CC)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)