[llvm] r297958 - [AMDGPU] Run always inliner early in opt
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 09:11:46 PDT 2017
Author: rampitec
Date: Thu Mar 16 11:11:46 2017
New Revision: 297958
URL: http://llvm.org/viewvc/llvm-project?rev=297958&view=rev
Log:
[AMDGPU] Run always inliner early in opt
We can mark functions to always inline early in the opt. Since we do not have
call support this early inlining creates opportunities for inter-procedural
optimizations which would not occur otherwise.
Differential Revision: https://reviews.llvm.org/D31016
Added:
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=297958&r1=297957&r2=297958&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp Thu Mar 16 11:11:46 2017
@@ -244,6 +244,7 @@ void AMDGPUTargetMachine::adjustPassMana
}));
PM.add(createGlobalDCEPass());
}
+ PM.add(createAMDGPUAlwaysInlinePass());
});
}
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=297958&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/early-inline.ll Thu Mar 16 11:11:46 2017
@@ -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
+}
More information about the llvm-commits
mailing list