forked from OSchip/llvm-project
[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 llvm-svn: 297958
This commit is contained in:
parent
e5d7e6f5e3
commit
f80507979d
|
@ -244,6 +244,7 @@ void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
|
|||
}));
|
||||
PM.add(createGlobalDCEPass());
|
||||
}
|
||||
PM.add(createAMDGPUAlwaysInlinePass());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue