@@ -141,25 +141,34 @@ bb2:
141
141
return %9999 : $()
142
142
}
143
143
144
- sil @indirect_parameter_partial_apply_caller6 : $@convention(thin) (@callee_owned () -> () ) -> @out Builtin.Int1 {
145
- bb0(%1 : $*Builtin.Int1, %0 : $@callee_owned () -> () ):
144
+ sil @indirect_parameter_partial_apply_caller6 : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out Builtin.Int1 {
145
+ bb0(%1 : $*Builtin.Int1, %0 : $@callee_owned () -> @out Builtin.Int1 ):
146
146
br bb1
147
147
148
148
bb1:
149
- apply %0() : $@callee_owned () -> ()
149
+ apply %0(%1 ) : $@callee_owned () -> @out Builtin.Int1
150
150
cond_br undef, bb1, bb2
151
151
152
152
bb2:
153
153
%9999 = tuple()
154
154
return %9999 : $()
155
155
}
156
156
157
- sil @indirect_parameter_partial_apply_caller7 : $@convention(thin) (@callee_owned () -> () ) -> @out (Builtin.Int1, Builtin.Int1) {
158
- bb0(%1 : $*(Builtin.Int1, Builtin.Int1), %0 : $@callee_owned () -> () ):
157
+ sil @indirect_parameter_partial_apply_caller7 : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out (Builtin.Int1, Builtin.Int1) {
158
+ bb0(%1 : $*(Builtin.Int1, Builtin.Int1), %0 : $@callee_owned () -> @out Builtin.Int1 ):
159
159
br bb1
160
160
161
161
bb1:
162
- apply %0() : $@callee_owned () -> ()
162
+ %2 = alloc_stack $Builtin.Int1
163
+ %3 = alloc_stack $Builtin.Int1
164
+ apply %0(%2) : $@callee_owned () -> @out Builtin.Int1
165
+ apply %0(%3) : $@callee_owned () -> @out Builtin.Int1
166
+ %4 = load %2: $*Builtin.Int1
167
+ %5 = load %3: $*Builtin.Int1
168
+ %6 = tuple(%4 : $Builtin.Int1, %5: $Builtin.Int1)
169
+ store %6 to %1 : $*(Builtin.Int1, Builtin.Int1)
170
+ dealloc_stack %3: $*Builtin.Int1
171
+ dealloc_stack %2: $*Builtin.Int1
163
172
cond_br undef, bb1, bb2
164
173
165
174
bb2:
@@ -174,6 +183,34 @@ bb2:
174
183
// We can't call this one b/c it is just a declaration.
175
184
// CHECK: [[UNSPECIALIZED_FUN_DECL:%.*]] = function_ref @simple_partial_apply_caller_decl : $@convention(thin) (@owned @callee_owned (Builtin.Int1) -> Builtin.Int1) -> Builtin.Int1
176
185
// CHECK: apply [[UNSPECIALIZED_FUN_DECL]]
186
+
187
+ // We handle closures with indirect results.
188
+ // CHECK: [[CLOSUREFUN:%.*]] = function_ref @indirect_parameter_partial_apply_fun
189
+ // CHECK-NOT: partial_apply [[CLOSUREFUN]]()
190
+ // CHECK: [[INLINEDCLOSURE_CALLER1:%.*]] = function_ref @{{.*}}indirect_parameter_partial_apply_fun__indirect_parameter_partial_apply_caller1
191
+ // CHECK-NOT: partial_apply [[CLOSUREFUN]]()
192
+
193
+ // We don't handle captured indirect parameters yet.
194
+ // CHECK: [[CLOSURE2:%.*]] = partial_apply [[CLOSUREFUN]](%{{.*}})
195
+ // CHECK: [[CLOSURE3:%.*]] = partial_apply [[CLOSUREFUN]](%{{.*}})
196
+ // CHECK: [[CLOSURE4:%.*]] = partial_apply [[CLOSUREFUN]](%{{.*}})
197
+
198
+ // CHECK: [[CALLER1:%.*]] = function_ref @indirect_parameter_partial_apply_caller1
199
+ // CHECK: [[CALLER2:%.*]] = function_ref @indirect_parameter_partial_apply_caller2
200
+ // CHECK: [[CALLER3:%.*]] = function_ref @indirect_parameter_partial_apply_caller3
201
+ // CHECK: [[CALLER4:%.*]] = function_ref @indirect_parameter_partial_apply_caller4
202
+
203
+ // Closure with indirect result but no captured indirect parameter.
204
+ // CHECK-NOT: apply [[CALLER1]]
205
+ // apply [[INLINEDCLOSURE_CALLER1]]()
206
+ // CHECK-NOT: apply [[CALLER1]]
207
+
208
+ // Closures with captured indirect parameters.
209
+ // apply [[CALLER2]]([[CLOSURE2]])
210
+ // apply [[CALLER3]]([[CLOSURE3]])
211
+ // apply [[CALLER4]]([[CLOSURE4]])
212
+
213
+ // CHECK: return
177
214
sil @loop_driver : $@convention(thin) (Builtin.Int1, Builtin.Int1) -> () {
178
215
bb0(%0 : $Builtin.Int1, %1 : $Builtin.Int1):
179
216
%2 = function_ref @simple_partial_apply_fun : $@convention(thin) (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
@@ -203,16 +240,15 @@ bb0(%0 : $Builtin.Int1, %1 : $Builtin.Int1):
203
240
apply %17(%12) : $@convention(thin) (@callee_owned (@in Builtin.Int1, Builtin.Int1) -> @out Builtin.Int1) -> ()
204
241
apply %18(%13) : $@convention(thin) (@callee_owned (@in Builtin.Int1) -> @out Builtin.Int1) -> ()
205
242
apply %19(%14) : $@convention(thin) (@callee_owned () -> @out Builtin.Int1) -> ()
206
- //apply %20(%15) : $@convention(thin) (@callee_owned () -> ()) -> ()
207
243
208
244
// Make sure we handle when we already have an out parameter correctly.
209
245
%21 = alloc_stack $(Builtin.Int1, Builtin.Int1)
210
- %22 = function_ref @indirect_parameter_partial_apply_caller6 : $@convention(thin) (@callee_owned () -> () ) -> @out Builtin.Int1
211
- %23 = function_ref @indirect_parameter_partial_apply_caller7 : $@convention(thin) (@callee_owned () -> () ) -> @out (Builtin.Int1, Builtin.Int1)
246
+ %22 = function_ref @indirect_parameter_partial_apply_caller6 : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out Builtin.Int1
247
+ %23 = function_ref @indirect_parameter_partial_apply_caller7 : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out (Builtin.Int1, Builtin.Int1)
212
248
%24 = partial_apply %10(%9, %1, %9) : $@convention(thin) (@in Builtin.Int1, Builtin.Int1, @in Builtin.Int1) -> @out Builtin.Int1
213
249
%25 = partial_apply %10(%9, %1, %9) : $@convention(thin) (@in Builtin.Int1, Builtin.Int1, @in Builtin.Int1) -> @out Builtin.Int1
214
- // apply %22(%9, %24) : $@convention(thin) (@callee_owned () -> () ) -> @out Builtin.Int1
215
- // apply %23(%21, %25) : $@convention(thin) (@callee_owned () -> () ) -> @out (Builtin.Int1, Builtin.Int1)
250
+ apply %22(%9, %24) : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out Builtin.Int1
251
+ apply %23(%21, %25) : $@convention(thin) (@callee_owned () -> @out Builtin.Int1 ) -> @out (Builtin.Int1, Builtin.Int1)
216
252
217
253
dealloc_stack %21 : $*(Builtin.Int1, Builtin.Int1)
218
254
dealloc_stack %9 : $*Builtin.Int1
0 commit comments