@@ -286,3 +286,51 @@ bb0(%0 : $*Array<MyKlass>, %1 : @owned $MyKlass):
286
286
return %1 : $MyKlass
287
287
}
288
288
289
+ // CHECK-LABEL: sil [ossa] propagate_inside_loop :
290
+ // CHECK: bb1:
291
+ // CHECK-NOT: apply
292
+ // CHECK-LABEL: | end sil function 'propagate_inside_loop'
293
+
294
+ sil [ossa] @propagate_inside_loop : $@convention(thin) (@owned MyKlass) -> () {
295
+ bb0(%arg0 : @owned $MyKlass):
296
+ %0 = function_ref @swift_bufferAllocate : $@convention(thin) () -> @owned _ContiguousArrayStorage<MyKlass>
297
+ %1 = integer_literal $Builtin.Word, 1
298
+ %2 = struct $MyInt (%1 : $Builtin.Word)
299
+ %3 = apply %0() : $@convention(thin) () -> @owned _ContiguousArrayStorage<MyKlass>
300
+ %4 = metatype $@thin MyArray<MyKlass>.Type
301
+ %5 = function_ref @adoptStorage : $@convention(thin) (@owned _ContiguousArrayStorage<MyKlass>, MyInt, @thin MyArray<MyKlass>.Type) -> @owned (MyArray<MyKlass>, UnsafeMutablePointer<MyKlass>)
302
+ %6 = apply %5(%3, %2, %4) : $@convention(thin) (@owned _ContiguousArrayStorage<MyKlass>, MyInt, @thin MyArray<MyKlass>.Type) -> @owned (MyArray<MyKlass>, UnsafeMutablePointer<MyKlass>)
303
+ (%7, %8a) = destructure_tuple %6 : $(MyArray<MyKlass>, UnsafeMutablePointer<MyKlass>)
304
+ %8 = mark_dependence %8a : $UnsafeMutablePointer<MyKlass> on %7 : $MyArray<MyKlass>
305
+ %9 = struct_extract %8 : $UnsafeMutablePointer<MyKlass>, #UnsafeMutablePointer._rawValue
306
+ %10 = pointer_to_address %9 : $Builtin.RawPointer to [strict] $*MyKlass
307
+ %11 = integer_literal $Builtin.Word, 0
308
+ %11a = struct $MyInt (%11 : $Builtin.Word)
309
+ store %arg0 to [init] %10 : $*MyKlass
310
+ %26 = alloc_stack $MyKlass
311
+ %27 = function_ref @hoistableIsNativeTypeChecked : $@convention(method) (@guaranteed MyArray<MyKlass>) -> MyBool
312
+ %28 = apply %27(%7) : $@convention(method) (@guaranteed MyArray<MyKlass>) -> MyBool
313
+ %29 = function_ref @checkSubscript : $@convention(method) (MyInt, MyBool, @guaranteed MyArray<MyKlass>) -> _MyDependenceToken
314
+ %30 = apply %29(%11a, %28, %7) : $@convention(method) (MyInt, MyBool, @guaranteed MyArray<MyKlass>) -> _MyDependenceToken
315
+ %31 = function_ref @getElement : $@convention(method) (MyInt, MyBool, _MyDependenceToken, @guaranteed MyArray<MyKlass>) -> @owned MyKlass
316
+ br bb1
317
+
318
+ bb1:
319
+ %32 = apply %31(%11a, %28, %30, %7) : $@convention(method) (MyInt, MyBool, _MyDependenceToken, @guaranteed MyArray<MyKlass>) -> @owned MyKlass
320
+ store %32 to [init] %26 : $*MyKlass
321
+ destroy_addr %26 : $*MyKlass
322
+ cond_br undef, bb2, bb3
323
+
324
+ bb2:
325
+ br bb1
326
+
327
+ bb3:
328
+ br bb4
329
+
330
+ bb4:
331
+ dealloc_stack %26 : $*MyKlass
332
+ destroy_value %7 : $MyArray<MyKlass>
333
+ %52 = tuple ()
334
+ return %52 : $()
335
+ }
336
+
0 commit comments