@@ -30,6 +30,7 @@ class C {
30
30
sil [ossa] @dummy : $@convention(thin) () -> ()
31
31
sil [ossa] @barrier : $@convention(thin) () -> ()
32
32
sil [ossa] @getOwnedC : $@convention(thin) () -> (@owned C)
33
+ sil [ossa] @getOwnedB : $@convention(thin) () -> (@owned B)
33
34
sil [ossa] @takeOwnedC : $@convention(thin) (@owned C) -> ()
34
35
sil [ossa] @takeOwnedCTwice : $@convention(thin) (@owned C, @owned C) -> ()
35
36
sil [ossa] @takeGuaranteedC : $@convention(thin) (@guaranteed C) -> ()
@@ -38,14 +39,17 @@ sil [ossa] @takeGuaranteedAnyObject : $@convention(thin) (@guaranteed AnyObject)
38
39
// -O ignores this because there's no copy_value
39
40
// -Onone hoists the destroy and adds a poison flag.
40
41
//
41
- // CHECK-LABEL: sil [ossa] @testDestroyAfterCall : $@convention(thin) (@owned B) -> () {
42
- // CHECK: bb0(%0 : @owned $B):
43
- // CHECK-ONONE: destroy_value [poison] %0 : $B
42
+ // CHECK-LABEL: sil [ossa] @testDestroyAfterCall : {{.*}} {
43
+ // CHECK: bb0:
44
+ // CHECK: [[ARG:%.*]] = apply
45
+ // CHECK-ONONE: destroy_value [poison] [[ARG]] : $B
44
46
// CHECK: apply
45
- // CHECK-OPT: destroy_value %0 : $B
47
+ // CHECK-OPT: destroy_value [[ARG]] : $B
46
48
// CHECK-LABEL: } // end sil function 'testDestroyAfterCall'
47
- sil [ossa] @testDestroyAfterCall : $@convention(thin) (@owned B) -> () {
48
- bb0(%arg : @owned $B):
49
+ sil [ossa] @testDestroyAfterCall : $@convention(thin) () -> () {
50
+ bb0:
51
+ %getOwnedB = function_ref @getOwnedB : $@convention(thin) () -> (@owned B)
52
+ %arg = apply %getOwnedB() : $@convention(thin) () -> (@owned B)
49
53
%f = function_ref @dummy : $@convention(thin) () -> ()
50
54
%call = apply %f() : $@convention(thin) () -> ()
51
55
destroy_value %arg : $B
@@ -57,19 +61,22 @@ bb0(%arg : @owned $B):
57
61
// -Onone requres a destroy at the lifetime end. It reuses the
58
62
// existing one without adding poison.
59
63
//
60
- // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingStore : $@convention(thin) (@owned C) -> () {
61
- // CHECK: bb0(%0 : @owned $C):
64
+ // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingStore : {{.*}} {
65
+ // CHECK: bb0:
66
+ // CHECK: [[ARG:%.*]] = apply
62
67
// CHECK: [[ADR:%.*]] = alloc_stack $C
63
68
// CHECK-OPT-NOT: copy_value
64
- // CHECK-OPT: store %0 to [init] [[ADR]] : $*C
65
- // CHECK-ONONE: [[CP:%.*]] = copy_value %0 : $C
69
+ // CHECK-OPT: store [[ARG]] to [init] [[ADR]] : $*C
70
+ // CHECK-ONONE: [[CP:%.*]] = copy_value [[ARG]] : $C
66
71
// CHECK-ONONE: store [[CP]] to [init] [[ADR]] : $*C
67
72
// CHECK-OPT-NOT: destroy_value
68
- // CHECK-ONONE: destroy_value %0 : $C
73
+ // CHECK-ONONE: destroy_value [[ARG]] : $C
69
74
// CHECK: destroy_addr
70
75
// CHECK-LABEL: } // end sil function 'testDestroyAfterConsumingStore'
71
- sil [ossa] @testDestroyAfterConsumingStore : $@convention(thin) (@owned C) -> () {
72
- bb0(%arg : @owned $C):
76
+ sil [ossa] @testDestroyAfterConsumingStore : $@convention(thin) () -> () {
77
+ bb0:
78
+ %getOwnedC = function_ref @getOwnedC : $@convention(thin) () -> (@owned C)
79
+ %arg = apply %getOwnedC() : $@convention(thin) () -> (@owned C)
73
80
%adr = alloc_stack $C
74
81
%copy = copy_value %arg : $C
75
82
store %copy to [init] %adr : $*C
@@ -83,19 +90,22 @@ bb0(%arg : @owned $C):
83
90
// -O removes the copy/destroy
84
91
// -Onone requres a destroy at the lifetime end. It creates a new poison one.
85
92
//
86
- // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingStoreAndCall : $@convention(thin) (@owned C) -> () {
87
- // CHECK: bb0(%0 : @owned $C):
93
+ // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingStoreAndCall : {{.*}} {
94
+ // CHECK: bb0:
95
+ // CHECK: [[ARG:%.*]] = apply
88
96
// CHECK: [[ADR:%.*]] = alloc_stack $C
89
97
// CHECK-OPT-NOT: copy_value
90
- // CHECK-ONONE: copy_value %0 : $C
98
+ // CHECK-ONONE: copy_value [[ARG]] : $C
91
99
// CHECK: store %{{.*}} to [init] [[ADR]] : $*C
92
100
// CHECK-OPT-NOT: destroy_value
93
- // CHECK-ONONE: destroy_value [poison] %0 : $C
101
+ // CHECK-ONONE: destroy_value [poison] [[ARG]] : $C
94
102
// CHECK: apply
95
103
// CHECK: destroy_addr
96
104
// CHECK-LABEL: } // end sil function 'testDestroyAfterConsumingStoreAndCall'
97
- sil [ossa] @testDestroyAfterConsumingStoreAndCall : $@convention(thin) (@owned C) -> () {
98
- bb0(%arg : @owned $C):
105
+ sil [ossa] @testDestroyAfterConsumingStoreAndCall : $@convention(thin) () -> () {
106
+ bb0:
107
+ %getOwnedC = function_ref @getOwnedC : $@convention(thin) () -> (@owned C)
108
+ %arg = apply %getOwnedC() : $@convention(thin) () -> (@owned C)
99
109
%adr = alloc_stack $C
100
110
%copy = copy_value %arg : $C
101
111
store %copy to [init] %adr : $*C
@@ -111,16 +121,19 @@ bb0(%arg : @owned $C):
111
121
// -O removes the copy/destroy
112
122
// -Onone reuses the existint lifetime-ending destroy.
113
123
//
114
- // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingCall : $@convention(thin) (@owned C) -> () {
115
- // CHECK: bb0(%0 : @owned $C):
124
+ // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingCall : {{.*}} {
125
+ // CHECK: bb0:
126
+ // CHECK: [[ARG:%.*]] = apply
116
127
// CHECK-OPT-NOT: copy_value
117
- // CHECK-ONONE: %1 = copy_value %0 : $C
128
+ // CHECK-ONONE: copy_value [[ARG]] : $C
118
129
// CHECK: apply {{.*}} : $@convention(thin) (@owned C) -> ()
119
130
// CHECK-OPT-NOT: destroy_value
120
- // CHECK-ONONE: destroy_value %0 : $C
131
+ // CHECK-ONONE: destroy_value [[ARG]] : $C
121
132
// CHECK-LABEL: } // end sil function 'testDestroyAfterConsumingCall'
122
- sil [ossa] @testDestroyAfterConsumingCall : $@convention(thin) (@owned C) -> () {
123
- bb0(%arg : @owned $C):
133
+ sil [ossa] @testDestroyAfterConsumingCall : $@convention(thin) () -> () {
134
+ bb0:
135
+ %getOwnedC = function_ref @getOwnedC : $@convention(thin) () -> (@owned C)
136
+ %arg = apply %getOwnedC() : $@convention(thin) () -> (@owned C)
124
137
%copy = copy_value %arg : $C
125
138
%f = function_ref @takeOwnedC : $@convention(thin) (@owned C) -> ()
126
139
%call = apply %f(%copy) : $@convention(thin) (@owned C) -> ()
@@ -132,17 +145,20 @@ bb0(%arg : @owned $C):
132
145
// -O removes the copy/destroy
133
146
// -Onone requres a destroy at the lifetime end. It creates a new poison one.
134
147
//
135
- // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingCallAndCall : $@convention(thin) (@owned C) -> () {
136
- // CHECK: bb0(%0 : @owned $C):
148
+ // CHECK-LABEL: sil [ossa] @testDestroyAfterConsumingCallAndCall : {{.*}} {
149
+ // CHECK: bb0:
150
+ // CHECK: [[ARG:%.*]] = apply
137
151
// CHECK-OPT-NOT: copy_value
138
- // CHECK-ONONE: copy_value %0 : $C
152
+ // CHECK-ONONE: copy_value [[ARG]] : $C
139
153
// CHECK: apply %{{.*}}(%{{.*}}) : $@convention(thin) (@owned C) -> ()
140
154
// CHECK-OPT-NOT: destroy_value
141
- // CHECK-ONONE: destroy_value [poison] %0 : $C
155
+ // CHECK-ONONE: destroy_value [poison] [[ARG]] : $C
142
156
// CHECK: apply
143
157
// CHECK-LABEL: } // end sil function 'testDestroyAfterConsumingCallAndCall'
144
- sil [ossa] @testDestroyAfterConsumingCallAndCall : $@convention(thin) (@owned C) -> () {
145
- bb0(%arg : @owned $C):
158
+ sil [ossa] @testDestroyAfterConsumingCallAndCall : $@convention(thin) () -> () {
159
+ bb0:
160
+ %getOwnedC = function_ref @getOwnedC : $@convention(thin) () -> (@owned C)
161
+ %arg = apply %getOwnedC() : $@convention(thin) () -> (@owned C)
146
162
%copy = copy_value %arg : $C
147
163
%f1 = function_ref @takeOwnedC : $@convention(thin) (@owned C) -> ()
148
164
%call1 = apply %f1(%copy) : $@convention(thin) (@owned C) -> ()
0 commit comments