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) {
89 std::vector<GlobalAlias*> AliasesToRemove;
95 if (
Function* F = dyn_cast<Function>(
A.getAliasee())) {
96 A.replaceAllUsesWith(F);
97 AliasesToRemove.push_back(&A);
106 A->eraseFromParent();
122 unsigned AS = GV.getType()->getAddressSpace();
126 recursivelyVisitUsers(GV, FuncsToAlwaysInline);
137 if (!FuncsToAlwaysInline.
count(&F))
138 FuncsToNoInline.
insert(&F);
140 FuncsToAlwaysInline.
insert(&F);
145 for (
Function *F : FuncsToAlwaysInline)
151 return !FuncsToAlwaysInline.empty() || !FuncsToNoInline.empty();
155 return new AMDGPUAlwaysInline(GlobalOpt);
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void push_back(const T &Elt)
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
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.
Address space for local memory.
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.
#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...
Address space for region memory. (GDS)
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
iterator_range< global_iterator > globals()
iterator_range< alias_iterator > aliases()