Files
swift-mirror/test/SIL/verifier-fail-address-phi-ossa.sil
Michael Gottesman c577055100 [move-only] Instead of using AccessUseVisitor to visit addresses use TransitiveAddressVisitor.
This makes it so that the move address checker is not dependent on starting the
traversal at a base object. I also included verifier checks that the API can
visit all address uses for:

1. project_box.
2. alloc_stack.
3. ref_element_addr.
4. ref_tail_addr.
5. global_addr_inst.

this is because this visitor is now apart of the SIL API definition as being
able to enumerate /all/ addresses derived from a specific chosen address value.

This is a refactoring NFCI change.

rdar://108510644
2023-04-25 10:51:03 -07:00

35 lines
821 B
Plaintext

// RUN: %empty-directory(%t)
// RUN: not --crash %target-sil-opt -enable-sil-verify-all %s 2> %t/err.txt
// RUN: %FileCheck %s < %t/err.txt
// REQUIRES: asserts
class Klass {}
struct MyStruct {
@_hasStorage var k: Klass
}
// The SIL verifier must crash on address phis.
//
// CHECK: SIL verification failed: Block arguments cannot be addresses: !arg->getType().isAddress()
sil [ossa] @handle_phi_address_nodes : $@convention(thin) (@owned Klass) -> () {
bb0(%0 : @owned $Klass):
%1 = alloc_stack $MyStruct
%2 = struct_element_addr %1 : $*MyStruct, #MyStruct.k
store %0 to [init] %2 : $*Klass
cond_br undef, bb1, bb2
bb1:
br bb3(%1 : $*MyStruct)
bb2:
br bb3(%1 : $*MyStruct)
bb3(%7 : $*MyStruct):
destroy_addr %7 : $*MyStruct
dealloc_stack %1 : $*MyStruct
%9999 = tuple()
return %9999 : $()
}