28 "amdgpu-stress-function-calls",
30 cl::desc(
"Force all functions to be noinline"),
39 AMDGPUAlwaysInline(
bool GlobalOpt =
false) :
40 ModulePass(ID), GlobalOpt(GlobalOpt) { }
41 bool runOnModule(
Module &M)
override;
43 void getAnalysisUsage(AnalysisUsage &AU)
const override {
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());
102 A.replaceAllUsesWith(
F);
103 AliasesToRemove.push_back(&
A);
112 A->eraseFromParent();
128 unsigned AS = GV.getAddressSpace();
137 = StressCalls ? Attribute::AlwaysInline : Attribute::NoInline;
140 if (!
F.isDeclaration() && !
F.use_empty() &&
141 !
F.hasFnAttribute(IncompatAttr)) {
143 if (!FuncsToAlwaysInline.
count(&
F))
146 FuncsToAlwaysInline.
insert(&
F);
152 F->addFnAttr(Attribute::AlwaysInline);
155 F->addFnAttr(Attribute::NoInline);
160bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
165 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.
Machine Check Debug Module
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool EnableFunctionCalls
static bool EnableLowerModuleLDS
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...
A Module instance is used to store all the information related to an LLVM module.
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.
LLVM_READNONE constexpr 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.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)