Skip to content

Commit ee57c4b

Browse files
committed
Add extra tests for lifetime markers when we peephole initializeBufferWith* value witnesses.
1 parent 0991b2c commit ee57c4b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/IRGen/fixed_size_buffer_peepholes.sil

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ sil @produce : $@convention(thin) <T> (@out T) -> ()
99
sil @join_alloc_stack_copy_addr : $@convention(thin) <T> (@in T) -> () {
1010
entry(%x : $*T):
1111
// CHECK: [[BUFFER:%.*]] = alloca [[BUFFER_TYPE:\[.* x i8\]]]
12+
// CHECK: [[BUFFERLIFE:%.*]] = bitcast [[BUFFER_TYPE]]* [[BUFFER]]
13+
// CHECK: llvm.lifetime.start(i64 [[BUFFER_SIZE:12|24]], i8* [[BUFFERLIFE]])
1214
%a = alloc_stack $T
1315
// CHECK: [[ADDR:%.*]] = call %swift.opaque* %initializeBufferWithCopy([[BUFFER_TYPE]]* [[BUFFER]], %swift.opaque* %0, %swift.type* %T)
1416
copy_addr %x to [initialization] %a#1 : $*T
1517
// CHECK: call void @consume(%swift.opaque* noalias nocapture [[ADDR]], %swift.type* %T)
1618
%u = function_ref @consume : $@convention(thin) <T> (@in T) -> ()
1719
%z = apply %u<T>(%a#1) : $@convention(thin) <T> (@in T) -> ()
20+
// CHECK: [[BUFFERLIFE:%.*]] = bitcast [[BUFFER_TYPE]]* [[BUFFER]]
21+
// CHECK: llvm.lifetime.end(i64 [[BUFFER_SIZE]], i8* [[BUFFERLIFE]])
1822
dealloc_stack %a#0 : $*@local_storage T
1923
return undef : $()
2024
}

0 commit comments

Comments
 (0)