]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Split -amdgpu-early-inline-all option
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 28 Mar 2017 18:23:24 +0000 (18:23 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 28 Mar 2017 18:23:24 +0000 (18:23 +0000)
Previously it was covered by the internalization. It turns out we cannot
run internalizer in FE, it break separate compilation tests. Thus early
inliner gets its own option.

Differential Revision: https://reviews.llvm.org/D31429

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298935 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
test/CodeGen/AMDGPU/early-inline.ll

index e8954c59479822d3a5cee8a5123b7647c31ca266..c5302f7942fc6c7718f2533b97bd9e26acdc2216 100644 (file)
@@ -95,6 +95,13 @@ static cl::opt<bool> InternalizeSymbols(
   cl::init(false),
   cl::Hidden);
 
+// Option to inline all early.
+static cl::opt<bool> EarlyInlineAll(
+  "amdgpu-early-inline-all",
+  cl::desc("Inline all functions early"),
+  cl::init(false),
+  cl::Hidden);
+
 static cl::opt<bool> EnableSDWAPeephole(
   "amdgpu-sdwa-peephole",
   cl::desc("Enable SDWA peepholer"),
@@ -273,12 +280,14 @@ void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
   bool Internalize = InternalizeSymbols &&
                      (getOptLevel() > CodeGenOpt::None) &&
                      (getTargetTriple().getArch() == Triple::amdgcn);
+  bool EarlyInline = EarlyInlineAll &&
+                     (getOptLevel() > CodeGenOpt::None);
   bool AMDGPUAA = EnableAMDGPUAliasAnalysis && getOptLevel() > CodeGenOpt::None;
 
   Builder.addExtension(
     PassManagerBuilder::EP_ModuleOptimizerEarly,
-    [Internalize, AMDGPUAA](const PassManagerBuilder &,
-                            legacy::PassManagerBase &PM) {
+    [Internalize, EarlyInline, AMDGPUAA](const PassManagerBuilder &,
+                                         legacy::PassManagerBase &PM) {
       if (AMDGPUAA) {
         PM.add(createAMDGPUAAWrapperPass());
         PM.add(createAMDGPUExternalAAWrapperPass());
@@ -304,8 +313,9 @@ void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
           return !GV.use_empty();
         }));
         PM.add(createGlobalDCEPass());
-        PM.add(createAMDGPUAlwaysInlinePass());
       }
+      if (EarlyInline)
+        PM.add(createAMDGPUAlwaysInlinePass());
   });
 
   Builder.addExtension(
index 8395ad818abe4e258ead7ab74af3b7e70f4b10be..8d1d7642d5f2b7009e163c4fa1c342d8050f41fd 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 -amdgpu-internalize-symbols %s | FileCheck %s
+; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 -amdgpu-early-inline-all %s | FileCheck %s
 
 define i32 @callee(i32 %x) {
 entry: