blob: 6d9f90f949041d10d247495c9243c8b4b315eed0 [file] [log] [blame]
// 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!1 : (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 : $()
}