[llvm] r298281 - [AMDGPU] Run always inliner early in opt

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 11:06:45 PDT 2017


Author: kzhuravl
Date: Mon Mar 20 13:06:45 2017
New Revision: 298281

URL: http://llvm.org/viewvc/llvm-project?rev=298281&view=rev
Log:
[AMDGPU] Run always inliner early in opt

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

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

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp?rev=298281&r1=298280&r2=298281&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp Mon Mar 20 13:06:45 2017
@@ -252,6 +252,7 @@ void AMDGPUTargetMachine::adjustPassMana
           return !GV.use_empty();
         }));
         PM.add(createGlobalDCEPass());
+        PM.add(createAMDGPUAlwaysInlinePass());
       }
   });
 }

Added: llvm/trunk/test/CodeGen/AMDGPU/early-inline-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/early-inline-alias.ll?rev=298281&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/early-inline-alias.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/early-inline-alias.ll Mon Mar 20 13:06:45 2017
@@ -0,0 +1,12 @@
+; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 %s | FileCheck %s
+
+; CHECK: @add1alias = alias i32 (i32), i32 (i32)* @add1
+; CHECK: @add1alias2 = alias i32 (i32), i32 (i32)* @add1
+
+ at add1alias = alias i32 (i32), i32 (i32)* @add1
+ at add1alias2 = alias i32 (i32), i32 (i32)* @add1
+
+define i32 @add1(i32) {
+  %2 = add nsw i32 %0, 1
+  ret i32 %2
+}

Added: llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll?rev=298281&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll Mon Mar 20 13:06:45 2017
@@ -0,0 +1,21 @@
+; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 -amdgpu-internalize-symbols %s | FileCheck %s
+
+define i32 @callee(i32 %x) {
+entry:
+  %mul1 = mul i32 %x, %x
+  %mul2 = mul i32 %mul1, %x
+  %mul3 = mul i32 %mul1, %mul2
+  %mul4 = mul i32 %mul3, %mul2
+  %mul5 = mul i32 %mul4, %mul3
+  ret i32 %mul5
+}
+
+; CHECK-LABEL: @caller
+; CHECK: mul i32
+; CHECK-NOT: call i32
+
+define amdgpu_kernel i32 @caller(i32 %x) {
+entry:
+  %res = call i32 @callee(i32 %x)
+  ret i32 %res
+}




More information about the llvm-commits mailing list