Skip to content

Commit 3c91572

Browse files
Merge pull request #71180 from nate-chandler/test/20240126/1
[Test] Verify fix to inout_aliasable load [copy] to load_borrow promotion.
2 parents 42ce090 + 8253ce2 commit 3c91572

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/SILOptimizer/semantic-arc-opts-loadcopy-to-loadborrow.sil

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ final class Klass {
5757
class C {}
5858

5959
sil @getC : $@convention(thin) () -> (@owned C)
60+
sil @borrowC : $@convention(thin) (@guaranteed C) -> ()
6061

6162
extension Klass : MyFakeAnyObject {
6263
func myFakeMethod()
@@ -1637,3 +1638,16 @@ entry:
16371638
%retval = tuple ()
16381639
return %retval : $()
16391640
}
1641+
1642+
// CHECK-LABEL: sil [ossa] @dont_promote_load_copy_of_inout_aliasable : {{.*}} {
1643+
// CHECK: load [copy]
1644+
// CHECK-LABEL: } // end sil function 'dont_promote_load_copy_of_inout_aliasable'
1645+
sil [ossa] @dont_promote_load_copy_of_inout_aliasable : $@convention(thin) (@inout_aliasable C) -> () {
1646+
bb0(%addr : $*C):
1647+
%c = load [copy] %addr : $*C
1648+
%borrowC = function_ref @borrowC : $@convention(thin) (@guaranteed C) -> ()
1649+
apply %borrowC(%c) : $@convention(thin) (@guaranteed C) -> ()
1650+
destroy_value %c : $C
1651+
%5 = tuple ()
1652+
return %5 : $()
1653+
}

0 commit comments

Comments
 (0)