@@ -1915,7 +1915,7 @@ bb0(%0 : $*SomeData):
1915
1915
1916
1916
// CHECK-LABEL: CG of testAccessMarker
1917
1917
// CHECK-NEXT: Arg %0 Esc: A, Succ: (%0.1)
1918
- // CHECK-NEXT: Con [ref] %0.1 Esc: G , Succ:
1918
+ // CHECK-NEXT: Con [ref] %0.1 Esc: A , Succ:
1919
1919
// CHECK-LABEL: End
1920
1920
sil hidden @testAccessMarker : $@convention(thin) (@inout SomeData) -> () {
1921
1921
bb0(%0 : $*SomeData):
@@ -1927,6 +1927,34 @@ bb0(%0 : $*SomeData):
1927
1927
return %5 : $()
1928
1928
}
1929
1929
1930
+ // Test that end_access does not cause its storage to escape.
1931
+ //
1932
+ // CHECK-LABEL: CG of testEndAccess
1933
+ // CHECK: Val [ref] %0 Esc: , Succ: (%3)
1934
+ // CHECK: Con [int] %3 Esc: , Succ: (%3.1)
1935
+ // CHECK: Con [ref] %3.1 Esc: , Succ:
1936
+ // CHECK: End
1937
+ // CHECK: NoEscape: %0 = alloc_ref $IntWrapper
1938
+ // CHECK: to set_deallocating %0 : $IntWrapper
1939
+ // CHECK: NoEscape: %3 = ref_element_addr %0 : $IntWrapper, #IntWrapper.property
1940
+ // CHECK: to set_deallocating %0 : $IntWrapper
1941
+ // CHECK: MayEscape: %4 = begin_access [modify] [dynamic] [no_nested_conflict] %3 : $*Int64
1942
+ // CHECK: to set_deallocating %0 : $IntWrapper
1943
+ sil @testEndAccess : $@convention(thin) () -> () {
1944
+ bb0:
1945
+ %0 = alloc_ref $IntWrapper
1946
+ %1 = integer_literal $Builtin.Int64, 0
1947
+ %2 = struct $Int64 (%1 : $Builtin.Int64)
1948
+ %3 = ref_element_addr %0 : $IntWrapper, #IntWrapper.property
1949
+ %4 = begin_access [modify] [dynamic] [no_nested_conflict] %3 : $*Int64
1950
+ store %2 to %4 : $*Int64
1951
+ end_access %4 : $*Int64
1952
+ set_deallocating %0 : $IntWrapper
1953
+ dealloc_ref %0 : $IntWrapper
1954
+ %9 = tuple ()
1955
+ return %9 : $()
1956
+ }
1957
+
1930
1958
// -----------------------------------------------------------------------------
1931
1959
// Unreachable blocks are not mapped to the connection graph. Test
1932
1960
// that verification does not assert with "Missing escape connection
0 commit comments