22; RUN: opt -S -passes='loop-mssa(licm)' < %s | FileCheck %s
33
44declare i1 @cond (i32 %v ) readnone
5- declare void @capture (ptr %p ) readnone
5+ declare ptr @capture (ptr %p ) readnone
66
77define void @test_captured_after_loop (i32 %len ) {
88; CHECK-LABEL: @test_captured_after_loop(
@@ -27,7 +27,7 @@ define void @test_captured_after_loop(i32 %len) {
2727; CHECK: exit:
2828; CHECK-NEXT: [[C_INC1_LCSSA:%.*]] = phi i32 [ [[C_INC1]], [[LATCH]] ]
2929; CHECK-NEXT: store i32 [[C_INC1_LCSSA]], ptr [[COUNT]], align 4
30- ; CHECK-NEXT: call void @capture(ptr [[COUNT]])
30+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr [[COUNT]])
3131; CHECK-NEXT: ret void
3232;
3333entry:
5252 br i1 %cmp , label %exit , label %loop
5353
5454exit:
55- call void @capture (ptr %count )
55+ call ptr @capture (ptr %count )
5656 ret void
5757}
5858
@@ -71,7 +71,7 @@ define void @test_captured_in_loop(i32 %len) {
7171; CHECK: if:
7272; CHECK-NEXT: [[C_INC:%.*]] = add i32 [[C_INC2]], 1
7373; CHECK-NEXT: store i32 [[C_INC]], ptr [[COUNT]], align 4
74- ; CHECK-NEXT: call void @capture(ptr [[COUNT]])
74+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr [[COUNT]])
7575; CHECK-NEXT: br label [[LATCH]]
7676; CHECK: latch:
7777; CHECK-NEXT: [[C_INC1]] = phi i32 [ [[C_INC]], [[IF]] ], [ [[C_INC2]], [[LOOP]] ]
9595 %c = load i32 , ptr %count
9696 %c.inc = add i32 %c , 1
9797 store i32 %c.inc , ptr %count
98- call void @capture (ptr %count )
98+ call ptr @capture (ptr %count )
9999 br label %latch
100100
101101latch:
@@ -112,7 +112,7 @@ define void @test_captured_before_loop(i32 %len) {
112112; CHECK-NEXT: entry:
113113; CHECK-NEXT: [[COUNT:%.*]] = alloca i32, align 4
114114; CHECK-NEXT: store i32 0, ptr [[COUNT]], align 4
115- ; CHECK-NEXT: call void @capture(ptr [[COUNT]])
115+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr [[COUNT]])
116116; CHECK-NEXT: [[COUNT_PROMOTED:%.*]] = load i32, ptr [[COUNT]], align 4
117117; CHECK-NEXT: br label [[LOOP:%.*]]
118118; CHECK: loop:
@@ -135,7 +135,7 @@ define void @test_captured_before_loop(i32 %len) {
135135entry:
136136 %count = alloca i32
137137 store i32 0 , ptr %count
138- call void @capture (ptr %count )
138+ call ptr @capture (ptr %count )
139139 br label %loop
140140
141141loop:
@@ -163,7 +163,7 @@ define void @test_captured_before_loop_address_only(i32 %len) {
163163; CHECK-NEXT: entry:
164164; CHECK-NEXT: [[COUNT:%.*]] = alloca i32, align 4
165165; CHECK-NEXT: store i32 0, ptr [[COUNT]], align 4
166- ; CHECK-NEXT: call void @capture(ptr captures(address) [[COUNT]])
166+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr captures(address) [[COUNT]])
167167; CHECK-NEXT: [[COUNT_PROMOTED:%.*]] = load i32, ptr [[COUNT]], align 4
168168; CHECK-NEXT: br label [[LOOP:%.*]]
169169; CHECK: loop:
@@ -187,7 +187,7 @@ define void @test_captured_before_loop_address_only(i32 %len) {
187187entry:
188188 %count = alloca i32
189189 store i32 0 , ptr %count
190- call void @capture (ptr captures(address) %count )
190+ call ptr @capture (ptr captures(address) %count )
191191 br label %loop
192192
193193loop:
@@ -216,7 +216,7 @@ define void @test_captured_before_loop_byval(ptr byval(i32) align 4 %count, i32
216216; CHECK-LABEL: @test_captured_before_loop_byval(
217217; CHECK-NEXT: entry:
218218; CHECK-NEXT: store i32 0, ptr [[COUNT:%.*]], align 4
219- ; CHECK-NEXT: call void @capture(ptr [[COUNT]])
219+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr [[COUNT]])
220220; CHECK-NEXT: [[COUNT_PROMOTED:%.*]] = load i32, ptr [[COUNT]], align 4
221221; CHECK-NEXT: br label [[LOOP:%.*]]
222222; CHECK: loop:
@@ -238,7 +238,7 @@ define void @test_captured_before_loop_byval(ptr byval(i32) align 4 %count, i32
238238;
239239entry:
240240 store i32 0 , ptr %count
241- call void @capture (ptr %count )
241+ call ptr @capture (ptr %count )
242242 br label %loop
243243
244244loop:
@@ -283,7 +283,7 @@ define void @test_captured_after_loop_byval(ptr byval(i32) align 4 %count, i32 %
283283; CHECK: exit:
284284; CHECK-NEXT: [[C_INC1_LCSSA:%.*]] = phi i32 [ [[C_INC1]], [[LATCH]] ]
285285; CHECK-NEXT: store i32 [[C_INC1_LCSSA]], ptr [[COUNT]], align 4
286- ; CHECK-NEXT: call void @capture(ptr [[COUNT]])
286+ ; CHECK-NEXT: [[TMP0:%.*]] = call ptr @capture(ptr [[COUNT]])
287287; CHECK-NEXT: ret void
288288;
289289entry:
@@ -307,6 +307,6 @@ latch:
307307 br i1 %cmp , label %exit , label %loop
308308
309309exit:
310- call void @capture (ptr %count )
310+ call ptr @capture (ptr %count )
311311 ret void
312312}
0 commit comments