1 ; RUN: opt < %s -inline -sroa -S | FileCheck %s
2 ; RUN: opt < %s -passes='cgscc(inline,function(sroa))' -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
5 define i32 @test1f(i32 %i) {
9 define i32 @test1(i32 %W) {
10 %X = call i32 @test1f(i32 7)
13 ; CHECK-LABEL: @test1(
14 ; CHECK-NEXT: %Y = add i32 7, %W
15 ; CHECK-NEXT: ret i32 %Y
22 %T = type { i32, i32 }
25 define internal %T* @test2f(i1 %cond, %T* %P) {
26 br i1 %cond, label %T, label %F
29 %A = getelementptr %T, %T* %P, i32 0, i32 0
37 define i32 @test2(i1 %cond) {
40 %B = call %T* @test2f(i1 %cond, %T* %A)
41 %C = getelementptr %T, %T* %B, i32 0, i32 0
42 %D = load i32, i32* %C
45 ; CHECK-LABEL: @test2(
50 declare void @barrier() noduplicate
52 define internal i32 @f() {
53 call void @barrier() noduplicate
58 call void @barrier() noduplicate
62 define internal i32 @h() {
63 call void @barrier() noduplicate
72 ; The call to @f cannot be inlined as there is another callsite
73 ; calling @f, and @f contains a noduplicate call.
75 ; The call to @g cannot be inlined as it has external linkage.
77 ; The call to @h *can* be inlined.
81 ; CHECK: call i32 @f()
83 ; CHECK: call i32 @g()
85 ; CHECK-NOT: call i32 @h()
95 ; Inliner shouldn't delete calls it can't inline, even if they're trivially dead
96 ; CHECK-LABEL: @outer4(
97 define void @outer4(void ()* %inner4) {
99 ; CHECK: call void %inner4()
100 call void %inner4() nounwind readnone
104 declare void @inner5_inner()
106 define void @inner5(void ()* %x) {
107 call void %x() nounwind readnone
111 ; Inliner shouldn't delete calls it can't inline, even if they're trivially dead and temporarily indirect
112 ; CHECK-LABEL: @outer5(
113 define void @outer5() {
114 ; CHECK: call void @inner5_inner(
115 call void @inner5(void ()* @inner5_inner)