File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -1341,6 +1341,12 @@ bool SILInstruction::mayRequirePackMetadata() const {
1341
1341
if (isDeallocatingStack ())
1342
1342
return false ;
1343
1343
1344
+ // Terminators that exit the function must not result in pack metadata
1345
+ // materialization.
1346
+ auto *ti = dyn_cast<TermInst>(this );
1347
+ if (ti && ti->isFunctionExiting ())
1348
+ return false ;
1349
+
1344
1350
// Check results and operands for packs. If a pack appears, lowering the
1345
1351
// instruction might result in pack metadata emission.
1346
1352
for (auto result : getResults ()) {
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ struct S1 {}
22
22
struct S2 {}
23
23
struct S3 {}
24
24
25
+ struct GVT<each T> : Error {
26
+ }
27
+
25
28
struct GV<each T> {
26
29
var tu: (repeat each T)
27
30
}
@@ -143,6 +146,16 @@ entry:
143
146
return %retval : $()
144
147
}
145
148
149
+ // CHECK-SIL-LABEL: sil @return_variadic : {{.*}} {
150
+ // CHECK-SIL: [[RETVAL:%[^,]+]] = struct
151
+ // CHECK-SIL: return [[RETVAL]]
152
+ // CHECK-SIL-LABEL: } // end sil function 'return_variadic'
153
+ sil @return_variadic : $<each T>() -> GVT<repeat each T> {
154
+ entry:
155
+ %retval = struct $GVT<repeat each T> ()
156
+ return %retval : $GVT<repeat each T>
157
+ }
158
+
146
159
// =============================================================================
147
160
// FINISH: Instructions: Apply }}
148
161
// =============================================================================
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -pack-metadata-marker-inserter -enable-pack-metadata-stack-promotion=true | %FileCheck %s --check-prefixes CHECK-SIL
2
+
3
+ // REQUIRES: asserts
4
+
5
+ sil_stage lowered
6
+
7
+ import Builtin
8
+
9
+ protocol Error {}
10
+
11
+ struct GVT<each T> {
12
+ }
13
+
14
+ // CHECK-SIL-LABEL: sil @throw_variadic : {{.*}} {
15
+ // CHECK-SIL: [[ERROR:%[^,]+]] = struct
16
+ // CHECK-SIL: throw [[ERROR]]
17
+ // CHECK-SIL-LABEL: } // end sil function 'throw_variadic'
18
+ sil @throw_variadic : $<each T>() -> ((), @error GVT<repeat each T>) {
19
+ entry:
20
+ %retval = struct $GVT<repeat each T> ()
21
+ throw %retval : $GVT<repeat each T>
22
+ }
23
+
You can’t perform that action at this time.
0 commit comments