@@ -348,6 +348,39 @@ bb2:
348
348
cond_br %0, bb2, bb1
349
349
}
350
350
351
+ // libg.MyGlobal.mutableAddressor : Swift.Int32
352
+ sil [global_init] [dynamically_replacable] @_TF4libga8MyGlobalSi_dynamic : $@convention(thin) () -> Builtin.RawPointer
353
+
354
+ // Don't hoist dynamic_function_ref calls.
355
+ // CHECK-LABEL: sil @test_loopexit_and_loop_dynamic
356
+ // CHECK: bb0(%0 : $Builtin.Int1):
357
+ // CHECK: bb1:
358
+ // CHECK: apply
359
+ // CHECK: return
360
+ // CHECK: bb2:
361
+ // CHECK: apply
362
+ // CHECK: cond_br
363
+ sil @test_loopexit_and_loop_dynamic : $@convention(thin) (Builtin.Int1) -> Int64 {
364
+ bb0(%0 : $Builtin.Int1):
365
+ br bb2
366
+
367
+ bb1:
368
+ %1 = dynamic_function_ref @_TF4libga8MyGlobalSi_dynamic : $@convention(thin) () -> Builtin.RawPointer
369
+ %2 = apply %1() : $@convention(thin) () -> Builtin.RawPointer
370
+ %3 = pointer_to_address %2 : $Builtin.RawPointer to [strict] $*Int64
371
+ %4 = struct_element_addr %3 : $*Int64, #Int64._value
372
+ %5 = load %4 : $*Builtin.Int64
373
+ %r1 = struct $Int64 (%5 : $Builtin.Int64)
374
+ return %r1 : $Int64
375
+
376
+ bb2:
377
+ %11 = dynamic_function_ref @_TF4libga8MyGlobalSi_dynamic : $@convention(thin) () -> Builtin.RawPointer
378
+ %12 = apply %11() : $@convention(thin) () -> Builtin.RawPointer
379
+ %13 = pointer_to_address %12 : $Builtin.RawPointer to [strict] $*Int64
380
+ %14 = struct_element_addr %13 : $*Int64, #Int64._value
381
+ %15 = load %14 : $*Builtin.Int64
382
+ cond_br %0, bb2, bb1
383
+ }
351
384
// An init-call, which is guarded by an availability-check may not be speculated.
352
385
// In this test it may not be hoisted out of the loop.
353
386
// CHECK-LABEL: sil @test_availability_loop
0 commit comments