[PATCH] D31429: [AMDGPU] Split -amdgpu-early-inline-all option

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 11:35:56 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL298935: [AMDGPU] Split -amdgpu-early-inline-all option (authored by rampitec).

Changed prior to commit:
  https://reviews.llvm.org/D31429?vs=93263&id=93264#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31429

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -95,6 +95,13 @@
   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 @@
   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 @@
           return !GV.use_empty();
         }));
         PM.add(createGlobalDCEPass());
-        PM.add(createAMDGPUAlwaysInlinePass());
       }
+      if (EarlyInline)
+        PM.add(createAMDGPUAlwaysInlinePass());
   });
 
   Builder.addExtension(
Index: llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll
@@ -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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31429.93264.patch
Type: text/x-patch
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170328/1931fcd3/attachment.bin>


More information about the llvm-commits mailing list