1 ; RUN: opt < %s -passes='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 ptr @test2f(i1 %cond, ptr %P) {
26 br i1 %cond, label %T, label %F
36 define i32 @test2(i1 %cond) {
39 %B = call ptr @test2f(i1 %cond, ptr %A)
43 ; CHECK-LABEL: @test2(
48 declare void @barrier() noduplicate
50 define internal i32 @f() {
51 call void @barrier() noduplicate
56 call void @barrier() noduplicate
60 define internal i32 @h() {
61 call void @barrier() noduplicate
70 ; The call to @f cannot be inlined as there is another callsite
71 ; calling @f, and @f contains a noduplicate call.
73 ; The call to @g cannot be inlined as it has external linkage.
75 ; The call to @h *can* be inlined.
79 ; CHECK: call i32 @f()
81 ; CHECK: call i32 @g()
83 ; CHECK-NOT: call i32 @h()
93 ; Inliner shouldn't delete calls it can't inline, even if they're trivially dead
94 ; CHECK-LABEL: @outer4(
95 define void @outer4(ptr %inner4) {
97 ; CHECK: call void %inner4()
98 call void %inner4() nounwind readnone
102 declare void @inner5_inner()
104 define void @inner5(ptr %x) {
105 call void %x() nounwind readnone
109 ; Inliner shouldn't delete calls it can't inline, even if they're trivially dead and temporarily indirect
110 ; CHECK-LABEL: @outer5(
111 define void @outer5() {
112 ; CHECK: call void @inner5_inner(
113 call void @inner5(ptr @inner5_inner)