diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp')
| -rw-r--r-- | lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp | 16 | 
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp b/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp index 6f3742ed039b..c27425443abc 100644 --- a/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp +++ b/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp @@ -21,6 +21,12 @@ using namespace llvm;  namespace { +static cl::opt<bool> StressCalls( +  "amdgpu-stress-function-calls", +  cl::Hidden, +  cl::desc("Force all functions to be noinline"), +  cl::init(false)); +  class AMDGPUAlwaysInline : public ModulePass {    bool GlobalOpt; @@ -57,9 +63,13 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {      }    } +  auto NewAttr = StressCalls ? Attribute::NoInline : Attribute::AlwaysInline; +  auto IncompatAttr +    = StressCalls ? Attribute::AlwaysInline : Attribute::NoInline; +    for (Function &F : M) {      if (!F.hasLocalLinkage() && !F.isDeclaration() && !F.use_empty() && -        !F.hasFnAttribute(Attribute::NoInline)) +        !F.hasFnAttribute(IncompatAttr))        FuncsToClone.push_back(&F);    } @@ -71,8 +81,8 @@ bool AMDGPUAlwaysInline::runOnModule(Module &M) {    }    for (Function &F : M) { -    if (F.hasLocalLinkage() && !F.hasFnAttribute(Attribute::NoInline)) { -      F.addFnAttr(Attribute::AlwaysInline); +    if (F.hasLocalLinkage() && !F.hasFnAttribute(IncompatAttr)) { +      F.addFnAttr(NewAttr);      }    }    return false;  | 
