1 ; RUN: opt < %s -ipsccp -S | FileCheck %s
3 ;;======================== test1
5 define internal i32 @test1a(i32 %A) {
9 ; CHECK: define internal i32 @test1a
10 ; CHECK: ret i32 undef
12 define i32 @test1b() {
13 %X = call i32 @test1a( i32 17 )
16 ; CHECK: define i32 @test1b
22 ;;======================== test2
24 define internal i32 @test2a(i32 %A) {
25 %C = icmp eq i32 %A, 0
26 br i1 %C, label %T, label %F
28 %B = call i32 @test2a( i32 0 )
31 %C.upgrd.1 = call i32 @test2a(i32 1)
34 ; CHECK: define internal i32 @test2a
35 ; CHECK-NEXT: br label %T
36 ; CHECK: ret i32 undef
39 define i32 @test2b() {
40 %X = call i32 @test2a(i32 0)
43 ; CHECK: define i32 @test2b
44 ; CHECK-NEXT: %X = call i32 @test2a(i32 0)
45 ; CHECK-NEXT: ret i32 0
48 ;;======================== test3
50 @G = internal global i32 undef
52 define void @test3a() {
57 ; CHECK: define void @test3a
58 ; CHECK-NEXT: ret void
61 define i32 @test3b() {
63 %C = icmp eq i32 %V, 17
64 br i1 %C, label %T, label %F
69 store i32 123, i32* @G
72 ; CHECK: define i32 @test3b
77 ;;======================== test4
79 define internal {i64,i64} @test4a() {
80 %a = insertvalue {i64,i64} undef, i64 4, 1
81 %b = insertvalue {i64,i64} %a, i64 5, 0
85 define i64 @test4b() {
86 %a = invoke {i64,i64} @test4a()
87 to label %A unwind label %B
89 %b = extractvalue {i64,i64} %a, 0
90 %c = call i64 @test4c(i64 %b)
95 ; CHECK: define i64 @test4b()
96 ; CHECK: %c = call i64 @test4c(i64 5)
97 ; CHECK-NEXT: ret i64 5
100 define internal i64 @test4c(i64 %a) {
103 ; CHECK: define internal i64 @test4c
104 ; CHECK: ret i64 undef
108 ;;======================== test5
111 define internal {i64,i64} @test5a() {
112 %a = insertvalue {i64,i64} undef, i64 4, 1
113 %b = insertvalue {i64,i64} %a, i64 5, 0
117 define i64 @test5b() {
118 %a = invoke {i64,i64} @test5a()
119 to label %A unwind label %B
121 %c = call i64 @test5c({i64,i64} %a)
127 ; CHECK: define i64 @test5b()
129 ; CHECK-NEXT: %c = call i64 @test5c(%0 %a)
130 ; CHECK-NEXT: ret i64 5
132 define internal i64 @test5c({i64,i64} %a) {
133 %b = extractvalue {i64,i64} %a, 0
138 ;;======================== test6
140 define i64 @test6a() {
144 define i64 @test6b() {
145 %a = call i64 @test6a()
148 ; CHECK: define i64 @test6b
151 ;;======================== test7
156 define internal {i32, i32} @test7a(i32 %A) {
158 %mrv0 = insertvalue %T undef, i32 %X, 0
159 %mrv1 = insertvalue %T %mrv0, i32 %A, 1
162 ; CHECK-NEXT: %mrv0 = insertvalue %T undef, i32 18, 0
163 ; CHECK-NEXT: %mrv1 = insertvalue %T %mrv0, i32 17, 1
166 define i32 @test7b() {
167 %X = call {i32, i32} @test7a(i32 17)
168 %Y = extractvalue {i32, i32} %X, 0
171 ; CHECK: define i32 @test7b
172 ; CHECK-NEXT: call %T @test7a(i32 17)
173 ; CHECK-NEXT: ret i32 36
176 ;;======================== test8
179 define internal {} @test8a(i32 %A, i32* %P) {
180 store i32 %A, i32* %P
183 ; CHECK-NEXT: store i32 5,
187 define void @test8b(i32* %P) {
188 %X = call {} @test8a(i32 5, i32* %P)
190 ; CHECK: define void @test8b
191 ; CHECK-NEXT: call {} @test8a
192 ; CHECK-NEXT: ret void
195 ;;======================== test9
197 @test9g = internal global { } zeroinitializer
199 define void @test9() {
201 %local_foo = alloca { }
203 store { } %0, { }* %local_foo