Skip to content

Commit d13cc69

Browse files
committed
Add an ARC test case for the releasenone attribute
1 parent 93ab930 commit d13cc69

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/SILOptimizer/arcsequenceopts.sil

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,3 +2163,31 @@ bb0(%0 : $@callee_guaranteed () -> ()):
21632163
%9999 = tuple()
21642164
return %9999 : $()
21652165
}
2166+
2167+
// Make sure we can move a release across a releasenone functions.
2168+
//
2169+
// CHECK-LABEL: sil @testReleaseNoneAttribute
2170+
// CHECK-NOT: strong_retain
2171+
// CHECK: [[RELEASENONE:%.*]] = function_ref @releaseNone
2172+
// CHECK-NOT: strong_retain
2173+
// CHECK: apply [[RELEASENONE]]
2174+
// CHECK-NOT: strong_retain
2175+
// CHECK: [[MAYRELEASE:%.*]] = function_ref @mayRelease
2176+
// CHECK-NOT: strong_retain
2177+
// CHECK: apply [[MAYRELEASE]]
2178+
// CHECK-NOT: strong_retain
2179+
// CHECK: return
2180+
sil [releasenone] @releaseNone : $@convention(thin) () -> ()
2181+
sil @mayRelease : $@convention(thin) () -> ()
2182+
2183+
sil @testReleaseNoneAttribute : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () {
2184+
bb0(%0 : $Builtin.NativeObject):
2185+
%1 = function_ref @releaseNone : $@convention(thin) () -> ()
2186+
strong_retain %0 : $Builtin.NativeObject
2187+
%2 = apply %1() : $@convention(thin) () -> ()
2188+
%3 = function_ref @mayRelease : $@convention(thin) () -> ()
2189+
%4 = apply %3() : $@convention(thin) () -> ()
2190+
strong_release %0 : $Builtin.NativeObject
2191+
%10 = tuple()
2192+
return %10 : $()
2193+
}

0 commit comments

Comments
 (0)