blob: c75c2b962548e4a94db3ec07eccb73950ac9d68b [file] [log] [blame]
// RUN: %target-sil-opt -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | FileCheck %s
sil_stage canonical
import Builtin
import Swift
sil [_semantics "no_inline_plz"] @callee_func : $@convention(thin) () -> Int32 {
bb0:
%0 = integer_literal $Builtin.Int32, 3 // user: %1
%1 = struct $Int32 (%0 : $Builtin.Int32) // user: %2
return %1 : $Int32 // id: %2
}
//CHECK-LABEL: caller_func
//CHECK: function_ref
//CHECK: apply
//CHECK-NEXT: ret
sil @caller_func : $@convention(thin) () -> Int32 {
bb0:
%0 = function_ref @callee_func : $@convention(thin) () -> Int32 // user: %1
%1 = apply %0() : $@convention(thin) () -> Int32 // user: %2
return %1 : $Int32 // id: %2
}
// A function annotated with the @effects(readonly) attribute.
sil [readonly] @callee_func2 : $@convention(thin) () -> Int32 {
bb0:
%0 = integer_literal $Builtin.Int32, 3 // user: %1
%1 = struct $Int32 (%0 : $Builtin.Int32) // user: %2
return %1 : $Int32 // id: %2
}
//CHECK-LABEL: caller_func1
//CHECK: function_ref
//CHECK: apply
//CHECK-NEXT: ret
sil @caller_func1 : $@convention(thin) () -> Int32 {
bb0:
%0 = function_ref @callee_func2 : $@convention(thin) () -> Int32 // user: %1
%1 = apply %0() : $@convention(thin) () -> Int32 // user: %2
return %1 : $Int32 // id: %2
}