Skip to content

Commit e7f6377

Browse files
committed
[sil] Now that we are enforcing that pack_metadata insts are only allowed in LoweredSIL, update some tests by splitting them into their own Lowered file.
1 parent ddd8c01 commit e7f6377

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

test/SIL/Parser/pack_metadata.sil

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-sil-opt -enable-sil-verify-all=true %s | %target-sil-opt -enable-sil-verify-all=true | %FileCheck %s
22

3+
sil_stage lowered
4+
35
// CHECK-LABEL: sil @markers : {{.*}} {
46
// CHECK: [[MARKER:%[^,]+]] = alloc_pack_metadata
57
// CHECK: dealloc_pack_metadata [[MARKER]]

test/SIL/verifier_failures.sil

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-sil-opt -emit-sorted-sil -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
2+
23
// REQUIRES: asserts
34

45
sil_stage canonical
@@ -17,28 +18,3 @@ sil [ossa] @end_borrow_1_addr_alloc_stack : $@convention(thin) () -> () {
1718
%retval = tuple ()
1819
return %retval : $()
1920
}
20-
21-
// CHECK-LABEL: Begin Error in function alloc_pack_metadata_before_tuple
22-
// CHECK: SIL verification failed: Introduces instruction of kind which cannot emit on-stack pack metadata:
23-
// CHECK-LABEL: End Error in function alloc_pack_metadata_before_tuple
24-
sil @alloc_pack_metadata_before_tuple : $@convention(thin) () -> () {
25-
%marker = alloc_pack_metadata $()
26-
%retval = tuple ()
27-
dealloc_pack_metadata %marker : $*()
28-
return %retval : $()
29-
}
30-
31-
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
32-
// CHECK: SIL verification failed: stack dealloc does not match most recent stack alloc:
33-
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
34-
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
35-
// CHECK: SIL verification failed: Must have alloc_pack_metadata operand
36-
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
37-
sil @dealloc_pack_metadata_with_bad_operand : $@convention(thin) <each T> () -> () {
38-
%marker = alloc_pack_metadata $()
39-
// To make the %marker legal.
40-
%out = apply undef<Pack{repeat each T}>() : $@convention(thin) <each T>() -> ()
41-
dealloc_pack_metadata %out : $()
42-
%retval = tuple ()
43-
return %retval : $()
44-
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %target-sil-opt -emit-sorted-sil -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
2+
3+
// REQUIRES: asserts
4+
5+
sil_stage lowered
6+
7+
import Builtin
8+
9+
class C {}
10+
11+
// CHECK-LABEL: Begin Error in function alloc_pack_metadata_before_tuple
12+
// CHECK: SIL verification failed: Introduces instruction of kind which cannot emit on-stack pack metadata:
13+
// CHECK-LABEL: End Error in function alloc_pack_metadata_before_tuple
14+
sil @alloc_pack_metadata_before_tuple : $@convention(thin) () -> () {
15+
%marker = alloc_pack_metadata $()
16+
%retval = tuple ()
17+
dealloc_pack_metadata %marker : $*()
18+
return %retval : $()
19+
}
20+
21+
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
22+
// CHECK: SIL verification failed: stack dealloc does not match most recent stack alloc:
23+
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
24+
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
25+
// CHECK: SIL verification failed: Must have alloc_pack_metadata operand
26+
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
27+
sil @dealloc_pack_metadata_with_bad_operand : $@convention(thin) <each T> () -> () {
28+
%marker = alloc_pack_metadata $()
29+
// To make the %marker legal.
30+
%out = apply undef<Pack{repeat each T}>() : $@convention(thin) <each T>() -> ()
31+
dealloc_pack_metadata %out : $()
32+
%retval = tuple ()
33+
return %retval : $()
34+
}

0 commit comments

Comments
 (0)