27 "amdgpu-stress-function-calls",
29 cl::desc(
"Force all functions to be noinline"),
40 AMDGPUAlwaysInline(
bool GlobalOpt =
false) :
42 bool runOnModule(
Module &M)
override;
52 "AMDGPU Inline All Functions",
false,
false)
54 char AMDGPUAlwaysInline::
ID = 0;
56 void AMDGPUAlwaysInline::recursivelyVisitUsers(
66 while (!Stack.
empty()) {
68 if (!Visited.
insert(U).second)
74 FuncsToAlwaysInline.insert(F);
87 bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
88 std::vector<GlobalAlias*> AliasesToRemove;
94 if (
Function* F = dyn_cast<Function>(
A.getAliasee())) {
95 A.replaceAllUsesWith(F);
96 AliasesToRemove.push_back(&A);
105 A->eraseFromParent();
121 unsigned AS = GV.getAddressSpace();
125 recursivelyVisitUsers(GV, FuncsToAlwaysInline);
130 = StressCalls ? Attribute::AlwaysInline : Attribute::NoInline;
136 if (!FuncsToAlwaysInline.
count(&F))
137 FuncsToNoInline.
insert(&F);
139 FuncsToAlwaysInline.
insert(&F);
144 for (
Function *F : FuncsToAlwaysInline)
150 return !FuncsToAlwaysInline.empty() || !FuncsToNoInline.empty();
154 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...
Address space for region memory. (GDS)
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.
#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...
Address space for local memory.
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()