28 "amdgpu-stress-function-calls",
30 cl::desc(
"Force all functions to be noinline"),
41 AMDGPUAlwaysInline(
bool GlobalOpt =
false) :
43 bool runOnModule(
Module &M)
override;
53 "AMDGPU Inline All Functions",
false,
false)
55 char AMDGPUAlwaysInline::
ID = 0;
57 void AMDGPUAlwaysInline::recursivelyVisitUsers(
67 while (!Stack.
empty()) {
69 if (!Visited.
insert(U).second)
75 FuncsToAlwaysInline.insert(F);
88 bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
91 std::vector<GlobalAlias*> AliasesToRemove;
97 if (
Function* F = dyn_cast<Function>(
A.getAliasee())) {
98 A.replaceAllUsesWith(F);
99 AliasesToRemove.push_back(&A);
108 A->eraseFromParent();
124 unsigned AS = GV.getType()->getAddressSpace();
128 recursivelyVisitUsers(GV, FuncsToAlwaysInline);
133 = StressCalls ? Attribute::AlwaysInline : Attribute::NoInline;
139 if (!FuncsToAlwaysInline.
count(&F))
140 FuncsToNoInline.
insert(&F);
142 FuncsToAlwaysInline.
insert(&F);
147 for (
Function *F : FuncsToAlwaysInline)
153 return !FuncsToAlwaysInline.empty() || !FuncsToNoInline.empty();
157 return new AMDGPUAlwaysInline(GlobalOpt);
void push_back(const T &Elt)
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
Compute iterated dominance frontiers using a linear time algorithm.
A Module instance is used to store all the information related to an LLVM module. ...
AMDGPUAS getAMDGPUAS(const Module &M)
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Address space for local memory.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
initializer< Ty > init(const Ty &Val)
static bool EnableFunctionCalls
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool isEntryFunctionCC(CallingConv::ID CC)
Represent the analysis usage information of a pass.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
The AMDGPU TargetMachine interface definition for hw codgen targets.
unsigned REGION_ADDRESS
Address space for region memory.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
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.
LLVM_NODISCARD T pop_back_val()
void setPreservesAll()
Set by analyses that do not transform their input at all.
iterator_range< user_iterator > users()
LLVM_NODISCARD bool empty() const
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
iterator_range< global_iterator > globals()
iterator_range< alias_iterator > aliases()