1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
// RUN: %target-sil-opt %s -basic-instruction-property-dump -o /dev/null | %FileCheck %s
// REQUIRES: asserts
import Builtin
class X {
@_hasStorage var a: Builtin.Int32
@_hasStorage var x: X
init()
func foo()
}
class Y : X {}
sil_vtable X {}
sil_vtable Y {}
sil [readnone] @full_apply_site_effects_callee_1 : $@convention(thin) (@owned X) -> ()
sil [readnone] @full_apply_site_effects_callee_2 : $@convention(thin) (@owned X, @owned X, @owned X) -> ()
// CHECK-LABEL: @full_apply_site_effects
// CHECK: Inst #: 9
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 10
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 11
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 12
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 13
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 14
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 15
// CHECK: apply
// CHECK: Mem Behavior: MayHaveSideEffects
// CHECK: Release Behavior: MayRelease
// CHECK: Inst #: 16
// CHECK: Inst #: 17
// CHECK: apply
// CHECK: Mem Behavior: None
// CHECK: Release Behavior: MayRelease
sil @full_apply_site_effects : $@convention(thin) (@owned X) -> () {
bb0(%0 : $X):
%1 = function_ref @full_apply_site_effects_callee_1 : $@convention(thin) (@owned X) -> ()
%2 = partial_apply %1(%0) : $@convention(thin) (@owned X) -> ()
%3 = thin_to_thick_function %1 : $@convention(thin) (@owned X) -> () to $@callee_owned @convention(thick) (@owned X) -> ()
%4 = function_ref @full_apply_site_effects_callee_2 : $@convention(thin) (@owned X, @owned X, @owned X) -> ()
%5 = partial_apply %4(%0) : $@convention(thin) (@owned X, @owned X, @owned X) -> ()
%6 = partial_apply %5(%0) : $@callee_owned @convention(thick) (@owned X, @owned X) -> ()
%7 = partial_apply %6(%0) : $@callee_owned @convention(thick) (@owned X) -> ()
%8 = class_method %0 : $X, #X.foo : (X) -> () -> (), $@convention(method) (@guaranteed X) -> ()
%9 = convert_function %6 : $@callee_owned @convention(thick) (@owned X) -> () to $@callee_owned @convention(thick) (@owned Y) -> ()
apply %1(%0) : $@convention(thin) (@owned X) -> ()
apply %2() : $@callee_owned @convention(thick) () -> ()
apply %3(%0) : $@callee_owned @convention(thick) (@owned X) -> ()
apply %5(%0, %0) : $@callee_owned @convention(thick) (@owned X, @owned X) -> ()
apply %6(%0) : $@callee_owned @convention(thick) (@owned X) -> ()
apply %7() : $@callee_owned @convention(thick) () -> ()
// Make sure we properly handle full apply sites for which we can not
// trivially find an absolute referenced function.
apply %8(%0) : $@convention(method) (@guaranteed X) -> ()
%10 = unchecked_ref_cast %0 : $X to $Y
apply %9(%10) : $@callee_owned @convention(thick) (@owned Y) -> ()
return undef : $()
}
|