[PATCH] D31016: [AMDGPU] Run always inliner early in opt

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 09:23:53 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL297958: [AMDGPU] Run always inliner early in opt (authored by rampitec).

Changed prior to commit:
  https://reviews.llvm.org/D31016?vs=91961&id=92007#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31016

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


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
@@ -0,0 +1,21 @@
+; RUN: opt -mtriple=amdgcn-- -O1 -S -inline-threshold=1 %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 i32 @caller(i32 %x) {
+entry:
+  %res = call i32 @callee(i32 %x)
+  ret i32 %res
+}
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -244,6 +244,7 @@
         }));
         PM.add(createGlobalDCEPass());
       }
+      PM.add(createAMDGPUAlwaysInlinePass());
   });
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31016.92007.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170316/ce31563d/attachment.bin>


More information about the llvm-commits mailing list