@@ -4,6 +4,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
4
target triple = "arm64-apple-macos99.99"
5
5
6
6
; CHECK-LABEL: %func.Frame = type { ptr }
7
+ ; CHECK-LABEL: %big_types.Frame = type { <32 x i8>, [16 x i8], i64, ptr, %Integer8 }
7
8
8
9
; CHECK-LABEL: @func_cfp = constant <{ i32, i32 }>
9
10
; CHECK-SAME: <{
@@ -20,6 +21,16 @@ target triple = "arm64-apple-macos99.99"
20
21
i32 64 ; frame size
21
22
}>
22
23
24
+ @big_types_cfp = constant <{ i32 , i32 }>
25
+ <{ i32 trunc ( ; offset to @func from @big_types_cfp
26
+ i64 sub (
27
+ i64 ptrtoint (ptr @big_types to i64 ),
28
+ i64 ptrtoint (ptr getelementptr inbounds (<{ i32 , i32 }>, ptr @big_types_cfp , i32 0 , i32 1 ) to i64 )
29
+ )
30
+ to i32 ),
31
+ i32 64 ; frame size
32
+ }>
33
+
23
34
24
35
; CHECK-LABEL: @func(
25
36
; CHECK-SAME: ptr %buffer,
@@ -101,3 +112,48 @@ declare void @continuation_prototype(ptr, ptr)
101
112
102
113
declare swiftcorocc noalias ptr @allocate (i32 %size )
103
114
declare void @deallocate (ptr %ptr )
115
+
116
+ %Integer8 = type { i8 }
117
+
118
+ ; CHECK-LABEL: @big_types(
119
+ ; CHECK-SAME: ptr noalias %frame,
120
+ ; CHECK-SAME: ptr swiftcoro %allocator,
121
+ ; CHECK-SAME: i64 %index,
122
+ ; CHECK-SAME: ptr swiftself dereferenceable(32) %vec_addr
123
+ ; CHECK-SAME: ) {
124
+ ; CHECK: [[VEC_STK_BASE_PTR:%.*]] = getelementptr inbounds %big_types.Frame, ptr %frame, i32 0, i32 0
125
+ ; CHECK: [[VEC_STK_BASE_INT:%.*]] = ptrtoint ptr [[VEC_STK_BASE_PTR]] to i64
126
+ ; CHECK: [[VEC_STK_BIASED_INT:%.*]] = add i64 [[VEC_STK_BASE_INT]], 31
127
+ ; CHECK: [[VEC_STK_ALIGNED_INT:%.*]] = and i64 [[VEC_STK_BIASED_INT]], -32
128
+ ; CHECK: %vec_stk = inttoptr i64 [[VEC_STK_ALIGNED_INT]] to ptr
129
+ define swiftcorocc { ptr , ptr } @big_types (ptr noalias %frame , ptr swiftcoro %allocator , i64 %index , ptr nocapture swiftself dereferenceable (32 ) %vec_addr ) {
130
+ %element_addr = alloca %Integer8 , align 1
131
+ %id = tail call token @llvm.coro.id.retcon.once.dynamic (
132
+ i32 -1 ,
133
+ i32 16 ,
134
+ ptr nonnull @big_types_cfp ,
135
+ ptr %allocator ,
136
+ ptr %frame ,
137
+ ptr @continuation_prototype ,
138
+ ptr nonnull @allocate ,
139
+ ptr nonnull @deallocate
140
+ )
141
+ %handle = tail call ptr @llvm.coro.begin (token %id , ptr null )
142
+ call void @llvm.lifetime.start.p0 (i64 1 , ptr nonnull %element_addr )
143
+ %vec_original = load <32 x i8 >, ptr %vec_addr , align 32
144
+ %vec_stk = alloca <32 x i8 >, align 32
145
+ store <32 x i8 > %vec_original , ptr %vec_stk , align 32
146
+ %vec_original_2 = load <32 x i8 >, ptr %vec_stk , align 32
147
+ %index32 = trunc i64 %index to i32
148
+ %element_original = extractelement <32 x i8 > %vec_original_2 , i32 %index32
149
+ store i8 %element_original , ptr %element_addr , align 1
150
+ call ptr (...) @llvm.coro.suspend.retcon.p0 (ptr nonnull %element_addr )
151
+ %element_modified = load i8 , ptr %element_addr , align 1
152
+ %vec_original_3 = load <32 x i8 >, ptr %vec_stk , align 32
153
+ %vec_modified = insertelement <32 x i8 > %vec_original_3 , i8 %element_modified , i32 %index32
154
+ store <32 x i8 > %vec_modified , ptr %vec_addr , align 32
155
+ call void @llvm.lifetime.end.p0 (i64 1 , ptr nonnull %element_addr )
156
+ call i1 @llvm.coro.end (ptr %handle , i1 false , token none)
157
+ unreachable
158
+ }
159
+
0 commit comments