Files
swift-mirror/test/SILOptimizer/globalopt-iter.sil
Erik Eckstein e5eb15dcbe Swift SIL: replace the set_deallocating instruction with begin_dealloc_ref
Codegen is the same, but `begin_dealloc_ref` consumes the operand and produces a new SSA value.
This cleanly splits the liferange to the region before and within the destructor of a class.
2023-09-19 15:10:30 +02:00

30 lines
740 B
Plaintext

// RUN: %target-sil-opt -enable-sil-verify-all %s -object-outliner | %FileCheck %s
// REQUIRES: swift_in_compiler
import Builtin
import Swift
class B { }
class E : B { }
// CHECK: sil @patatino : $@convention(thin) () -> () {
// CHECK: bb0:
// CHECK-NEXT: integer_literal
// CHECK-NEXT: global_value @patatinoTv_ : $B
// CHECK-NEXT: strong_retain
// CHECK-NEXT: strong_release
// CHECK-NEXT: tuple ()
// CHECK-NEXT: return
// CHECK-NEXT: }
sil @patatino : $@convention(thin) () -> () {
%0 = integer_literal $Builtin.Word, 0
%1 = alloc_ref [tail_elems $Int64 * %0 : $Builtin.Word] $B
%2 = end_cow_mutation %1 : $B
%3 = begin_dealloc_ref %2 : $B of %1 : $B
dealloc_ref %3 : $B
%45 = tuple ()
return %45 : $()
}