@@ -2887,3 +2887,51 @@ bb1(%4 : $Builtin.Int32):
2887
2887
bb2(%5 : $MyErrorType):
2888
2888
throw %5 : $MyErrorType
2889
2889
}
2890
+
2891
+ protocol PM {
2892
+ var sum: Int { get nonmutating set }
2893
+ func done()
2894
+ }
2895
+
2896
+ extension PM {
2897
+ func plus() -> Self
2898
+ func minus()
2899
+ }
2900
+
2901
+
2902
+ public final class VV {
2903
+ @sil_stored final var m: PM { get set }
2904
+ init()
2905
+ deinit
2906
+ }
2907
+
2908
+ sil @plus : $@convention(method) <Self where Self : PM> (@in_guaranteed Self) -> @out Self
2909
+
2910
+ sil @minus : $@convention(method) <Self where Self : PM> (@in_guaranteed Self) -> ()
2911
+
2912
+ // CHECK-LABEL: sil @silcombine_dont_change_allocstack_for_opened_archetypes
2913
+ // CHECK-NOT: alloc_stack{{.*}}opened
2914
+ // CHECK: open_existential_addr {{%[0-9]+}} : $*PM to $*@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM
2915
+ // CHECK: return
2916
+ sil @silcombine_dont_change_allocstack_for_opened_archetypes : $@convention(thin) (@owned VV) -> () {
2917
+ bb0(%0 : $VV):
2918
+ %8 = alloc_stack $PM, let, name "x"
2919
+ %9 = ref_element_addr %0 : $VV, #VV.m
2920
+ %10 = alloc_stack $PM
2921
+ copy_addr %9 to [initialization] %10 : $*PM
2922
+ %12 = open_existential_addr %10 : $*PM to $*@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM
2923
+ %13 = init_existential_addr %8 : $*PM, $@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM
2924
+ %14 = function_ref @plus : $@convention(method) <τ_0_0 where τ_0_0 : PM> (@in_guaranteed τ_0_0) -> @out τ_0_0
2925
+ %15 = apply %14<@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM>(%13, %12) : $@convention(method) <τ_0_0 where τ_0_0 : PM> (@in_guaranteed τ_0_0) -> @out τ_0_0
2926
+ destroy_addr %12 : $*@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM
2927
+ deinit_existential_addr %10 : $*PM
2928
+ dealloc_stack %10 : $*PM
2929
+ %20 = function_ref @minus : $@convention(method) <τ_0_0 where τ_0_0 : PM> (@in_guaranteed τ_0_0) -> ()
2930
+ %21 = apply %20<@opened("090C3DB0-1C76-11E6-81C4-B8E856428C60") PM>(%13) : $@convention(method) <τ_0_0 where τ_0_0 : PM> (@in_guaranteed τ_0_0) -> ()
2931
+ destroy_addr %8 : $*PM
2932
+ dealloc_stack %8 : $*PM
2933
+ strong_release %0 : $VV
2934
+ %26 = tuple ()
2935
+ return %26 : $()
2936
+ }
2937
+
0 commit comments