30 AMDGPUAlwaysInline(
bool GlobalOpt =
false) :
32 bool runOnModule(
Module &M)
override;
33 StringRef getPassName()
const override {
return "AMDGPU Always Inline Pass"; }
39 "AMDGPU Inline All Functions",
false,
false)
41 char AMDGPUAlwaysInline::
ID = 0;
43 bool AMDGPUAlwaysInline::runOnModule(
Module &M) {
44 std::vector<GlobalAlias*> AliasesToRemove;
45 std::vector<Function *> FuncsToClone;
48 if (
Function*
F = dyn_cast<Function>(
A.getAliasee())) {
49 A.replaceAllUsesWith(
F);
50 AliasesToRemove.push_back(&
A);
61 if (!
F.hasLocalLinkage() && !
F.isDeclaration() && !
F.use_empty() &&
62 !
F.hasFnAttribute(Attribute::NoInline))
63 FuncsToClone.push_back(&
F);
70 F->replaceAllUsesWith(NewFunc);
74 if (
F.hasLocalLinkage() && !
F.hasFnAttribute(Attribute::NoInline)) {
75 F.addFnAttr(Attribute::AlwaysInline);
82 return new AMDGPUAlwaysInline(GlobalOpt);
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
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...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
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.