File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -1434,7 +1434,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
1434
1434
" unowned_release requires unowned type to be loadable" );
1435
1435
}
1436
1436
void checkDeallocStackInst (DeallocStackInst *DI) {
1437
- require (isa<AllocStackInst>(DI->getOperand ()),
1437
+ require (isa<SILUndef>(DI->getOperand ()) ||
1438
+ isa<AllocStackInst>(DI->getOperand ()),
1438
1439
" Operand of dealloc_stack must be an alloc_stack" );
1439
1440
}
1440
1441
void checkDeallocRefInst (DeallocRefInst *DI) {
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostics | FileCheck %s
2
+
3
+ sil_stage raw
4
+
5
+ import Builtin
6
+
7
+ class TheClass {}
8
+
9
+ // Ensure that when we remove the code after the apply of noreturn
10
+ // function nada, we don't fail verification on a dealloc_stack with
11
+ // an undef operand, but that we do later remove it in the diagnostics
12
+ // passes.
13
+
14
+ // CHECK-LABEL: sil @unreachable_dealloc_stack
15
+ sil @unreachable_dealloc_stack: $@convention(method) (@guaranteed TheClass) -> () {
16
+ bb0(%0 : $TheClass):
17
+ %1 = function_ref @nada : $@convention(c) @noreturn (Builtin.Int32) -> ()
18
+ %2 = integer_literal $Builtin.Int32, 0
19
+ // CHECK: apply{{.*}}
20
+ %3 = apply %1(%2) : $@convention(c) @noreturn (Builtin.Int32) -> ()
21
+ // CHECK-NEXT: unreachable
22
+ // CHECK-NOT: dealloc_stack
23
+ %4 = alloc_stack $TheClass
24
+ store %0 to %4 : $*TheClass
25
+ br bb1
26
+
27
+ bb1:
28
+ dealloc_stack %4 : $*TheClass
29
+ %5 = tuple ()
30
+ return %5 : $()
31
+ }
32
+
33
+ // CHECK-LABEL: sil @nada
34
+ sil @nada : $@convention(c) @noreturn (Builtin.Int32) -> ()
You can’t perform that action at this time.
0 commit comments