@@ -570,3 +570,48 @@ bb0(%0 : $C):
570
570
%9 = tuple ()
571
571
return %9 : $()
572
572
}
573
+
574
+ protocol P1 { }
575
+ protocol P2 { }
576
+ protocol P3 { }
577
+
578
+ sil @callee : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : P1, τ_0_1 : P2, τ_0_2 : P3> (@in τ_0_0, @in τ_0_2, @in τ_0_1) -> ()
579
+
580
+ // Check that the deallocations are created in the right order and the SILVerifier does not complain.
581
+
582
+ // CHECK-LABEL: sil @test_multiple_propagated_args
583
+ // CHECK-NOT: open_existential_addr
584
+ // CHECK-LABEL: } // end sil function 'test_multiple_propagated_args'
585
+ sil @test_multiple_propagated_args : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : P1, τ_0_1 : P2, τ_0_2 : P3> (@in τ_0_0, @in τ_0_2, @in τ_0_1) -> () {
586
+ bb0(%0 : $*τ_0_0, %1 : $*τ_0_2, %2 : $*τ_0_1):
587
+ %5 = alloc_stack $P1
588
+ %6 = init_existential_addr %5 : $*P1, $τ_0_0
589
+ copy_addr [take] %0 to [initialization] %6 : $*τ_0_0
590
+ %8 = alloc_stack $P3
591
+ %9 = init_existential_addr %8 : $*P3, $τ_0_2
592
+ copy_addr [take] %1 to [initialization] %9 : $*τ_0_2
593
+ %11 = alloc_stack $P2
594
+ %12 = init_existential_addr %11 : $*P2, $τ_0_1
595
+ copy_addr [take] %2 to [initialization] %12 : $*τ_0_1
596
+ %15 = function_ref @callee : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : P1, τ_0_1 : P2, τ_0_2 : P3> (@in τ_0_0, @in τ_0_2, @in τ_0_1) -> ()
597
+ %16 = open_existential_addr mutable_access %5 : $*P1 to $*@opened("76D54B80-FF66-11E9-B604-8C8590A6A134") P1
598
+ %17 = alloc_stack $@opened("76D54B80-FF66-11E9-B604-8C8590A6A134") P1
599
+ copy_addr %16 to [initialization] %17 : $*@opened("76D54B80-FF66-11E9-B604-8C8590A6A134") P1
600
+ %19 = open_existential_addr mutable_access %8 : $*P3 to $*@opened("76D54C34-FF66-11E9-B604-8C8590A6A134") P3
601
+ %20 = alloc_stack $@opened("76D54C34-FF66-11E9-B604-8C8590A6A134") P3
602
+ copy_addr %19 to [initialization] %20 : $*@opened("76D54C34-FF66-11E9-B604-8C8590A6A134") P3
603
+ %22 = open_existential_addr mutable_access %11 : $*P2 to $*@opened("76D54C84-FF66-11E9-B604-8C8590A6A134") P2
604
+ %23 = alloc_stack $@opened("76D54C84-FF66-11E9-B604-8C8590A6A134") P2
605
+ copy_addr %22 to [initialization] %23 : $*@opened("76D54C84-FF66-11E9-B604-8C8590A6A134") P2
606
+ %25 = apply %15<@opened("76D54B80-FF66-11E9-B604-8C8590A6A134") P1, @opened("76D54C84-FF66-11E9-B604-8C8590A6A134") P2, @opened("76D54C34-FF66-11E9-B604-8C8590A6A134") P3>(%17, %20, %23) : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : P1, τ_0_1 : P2, τ_0_2 : P3> (@in τ_0_0, @in τ_0_2, @in τ_0_1) -> ()
607
+ destroy_addr %11 : $*P2
608
+ dealloc_stack %23 : $*@opened("76D54C84-FF66-11E9-B604-8C8590A6A134") P2
609
+ destroy_addr %8 : $*P3
610
+ dealloc_stack %20 : $*@opened("76D54C34-FF66-11E9-B604-8C8590A6A134") P3
611
+ destroy_addr %5 : $*P1
612
+ dealloc_stack %17 : $*@opened("76D54B80-FF66-11E9-B604-8C8590A6A134") P1
613
+ dealloc_stack %11 : $*P2
614
+ dealloc_stack %8 : $*P3
615
+ dealloc_stack %5 : $*P1
616
+ return %25 : $()
617
+ }
0 commit comments