mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
edges into dead-end regions. - Only treat edges *into* dead-end regions as special; edges internal the region must use the normal rules. - Conservatively merge information along those edges rather than just picking one at random. This requires us to not walk into the region until we've processed all of the edges to it. - Make sure we prevent *any* stack allocations from being deallocated if the stack is inconsistent entering a block. Additionally, fix a bug which was incorrectly treating all blocks that don't themselves exit the function as ultimately leading to unreachable, which had inadvertently largely turned off the consistency check.
38 lines
1.6 KiB
Plaintext
38 lines
1.6 KiB
Plaintext
// RUN: %target-sil-opt -emit-sorted-sil -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
|
|
|
|
// REQUIRES: asserts
|
|
|
|
sil_stage lowered
|
|
|
|
import Builtin
|
|
|
|
class C {}
|
|
|
|
// CHECK-LABEL: Begin Error in function alloc_pack_metadata_before_tuple
|
|
// CHECK: SIL verification failed: Introduces instruction of kind which cannot emit on-stack pack metadata:
|
|
// CHECK-LABEL: End Error in function alloc_pack_metadata_before_tuple
|
|
sil @alloc_pack_metadata_before_tuple : $@convention(thin) () -> () {
|
|
%marker = alloc_pack_metadata $()
|
|
%retval = tuple ()
|
|
dealloc_pack_metadata %marker : $*()
|
|
return %retval : $()
|
|
}
|
|
|
|
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
|
|
// CHECK: SIL verification failed: deallocating allocation that is not the top of the stack
|
|
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
|
|
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
|
|
// CHECK: SIL verification failed: return with stack allocs that haven't been deallocated
|
|
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
|
|
// CHECK-LABEL: Begin Error in function dealloc_pack_metadata_with_bad_operand
|
|
// CHECK: SIL verification failed: Must have alloc_pack_metadata operand
|
|
// CHECK-LABEL: End Error in function dealloc_pack_metadata_with_bad_operand
|
|
sil @dealloc_pack_metadata_with_bad_operand : $@convention(thin) <each T> () -> () {
|
|
%marker = alloc_pack_metadata $()
|
|
// To make the %marker legal.
|
|
%out = apply undef<Pack{repeat each T}>() : $@convention(thin) <each T>() -> ()
|
|
dealloc_pack_metadata %out : $()
|
|
%retval = tuple ()
|
|
return %retval : $()
|
|
}
|