29 bool runOnModule(
Module &M)
override;
30 StringRef getPassName()
const override {
return "AMDGPU Always Inline Pass"; }
37 bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
38 std::vector<GlobalAlias*> AliasesToRemove;
39 std::vector<Function *> FuncsToClone;
42 if (
Function*
F = dyn_cast<Function>(
A.getAliasee())) {
43 A.replaceAllUsesWith(
F);
44 AliasesToRemove.push_back(&
A);
53 if (!
F.hasLocalLinkage() && !
F.isDeclaration() && !
F.use_empty() &&
54 !
F.hasFnAttribute(Attribute::NoInline))
55 FuncsToClone.push_back(&
F);
62 F->replaceAllUsesWith(NewFunc);
66 if (
F.hasLocalLinkage() && !
F.hasFnAttribute(Attribute::NoInline)) {
67 F.addFnAttr(Attribute::AlwaysInline);
74 return new AMDGPUAlwaysInline();
A Module instance is used to store all the information related to an LLVM module. ...
Function * CloneFunction(Function *F, ValueToValueMapTy &VMap, ClonedCodeInfo *CodeInfo=nullptr)
CloneFunction - Return a copy of the specified function and add it to that function's module...
ModulePass * createAMDGPUAlwaysInlinePass()
Module.h This file contains the declarations for the Module class.
void setLinkage(LinkageTypes LT)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Rename collisions when linking (static functions).
StringRef - Represent a constant reference to a string, i.e.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
iterator_range< alias_iterator > aliases()