Skip to content

Revert "[DebugInfo] Ignore noescape bit for all @convention(c) pointers" #42466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/swift/AST/ExtInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ class ASTExtInfoBuilder {

constexpr Representation getRepresentation() const {
unsigned rawRep = bits & RepresentationMask;
assert(rawRep <= unsigned(Representation::Last) &&
"unexpected SIL representation");
return Representation(rawRep);
}

Expand Down
15 changes: 0 additions & 15 deletions lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "swift/AST/DiagnosticsSema.h"
#include "swift/AST/DistributedDecl.h"
#include "swift/AST/ExistentialLayout.h"
#include "swift/AST/ExtInfo.h"
#include "swift/AST/FileUnit.h"
#include "swift/AST/ForeignAsyncConvention.h"
#include "swift/AST/ForeignErrorConvention.h"
Expand Down Expand Up @@ -3682,16 +3681,6 @@ FunctionType *FunctionType::get(ArrayRef<AnyFunctionType::Param> params,
auto properties = getFunctionRecursiveProperties(params, result, globalActor);
auto arena = getArena(properties);

if (info.hasValue()) {
// Canonicalize all thin functions to be escaping (to keep compatibility
// with generic parameters). Note that one can pass SIL-level representation
// here, so we need additional check for maximum non-SIL value.
Representation rep = info.getValue().getRepresentation();
if (rep <= FunctionTypeRepresentation::Last &&
isThinRepresentation(rep))
info = info->withNoEscape(false);
}

llvm::FoldingSetNodeID id;
FunctionType::Profile(id, params, result, info);

Expand Down Expand Up @@ -4109,10 +4098,6 @@ CanSILFunctionType SILFunctionType::get(
ext = ext.intoBuilder().withClangFunctionType(nullptr).build();
}

// Canonicalize all thin functions to be escaping (to keep compatibility
// with generic parameters)
if (isThinRepresentation(ext.getRepresentation()))
ext = ext.intoBuilder().withNoEscape(false);

llvm::FoldingSetNodeID id;
SILFunctionType::Profile(id, genericSig, ext, coroutineKind, callee, params,
Expand Down
9 changes: 5 additions & 4 deletions test/AutoDiff/SILOptimizer/activity_analysis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,13 +552,14 @@ func testTryApply(_ x: Float) -> Float {
// CHECK: bb0:
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
// CHECK: [NONE] // function_ref closure #1 in testTryApply(_:)
// CHECK: [NONE] %3 = thin_to_thick_function %2 : $@convention(thin) () -> () to $@noescape @callee_guaranteed () -> ()
// CHECK: [NONE] %4 = convert_function %3 : $@noescape @callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> @error Error
// CHECK: [NONE] %3 = convert_function %2 : $@convention(thin) () -> () to $@convention(thin) @noescape () -> ()
// CHECK: [NONE] %4 = thin_to_thick_function %3 : $@convention(thin) @noescape () -> () to $@noescape @callee_guaranteed () -> ()
// CHECK: [NONE] %5 = convert_function %4 : $@noescape @callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> @error Error
// CHECK: [NONE] // function_ref rethrowing(_:)
// CHECK: bb1:
// CHECK: [NONE] %7 = argument of bb1 : $()
// CHECK: [NONE] %8 = argument of bb1 : $()
// CHECK: bb2:
// CHECK: [NONE] %9 = argument of bb2 : $Error
// CHECK: [NONE] %10 = argument of bb2 : $Error

//===----------------------------------------------------------------------===//
// Coroutine differentiation (`begin_apply`)
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/objc_retainAutoreleasedReturnValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public func test(_ dict: NSDictionary) {
// CHECK: notail call i8* @llvm.objc.retainAutoreleasedReturnValue
// CHECK: ret void

// OPT-LABEL: define {{.*}}swiftcc void @"$s34objc_retainAutoreleasedReturnValue10useClosureyySo12NSDictionaryC_yADXEtF09$s34objc_bcd16Value4testyySo12H10CFyADXEfU_Tf1nc_n"(%TSo12NSDictionaryC* %0)
// OPT-LABEL: define {{.*}}swiftcc void @"$s34objc_retainAutoreleasedReturnValue4testyySo12NSDictionaryCFyADXEfU_"(%TSo12NSDictionaryC* %0)
// OPT: entry:
// OPT: call {{.*}}@objc_msgSend
// OPT: notail call i8* @llvm.objc.retainAutoreleasedReturnValue
Expand Down
2 changes: 1 addition & 1 deletion test/PrintAsObjC/blocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typealias MyBlockWithNoescapeParam = (() -> ()) -> Int
) {
}

// CHECK-NEXT: - (void (* _Nonnull)(NSInteger (* _Nonnull)(NSInteger, NSInteger)))returnsFunctionPointerThatTakesFunctionPointer SWIFT_WARN_UNUSED_RESULT;
// CHECK-NEXT: - (void (* _Nonnull)(SWIFT_NOESCAPE NSInteger (* _Nonnull)(NSInteger, NSInteger)))returnsFunctionPointerThatTakesFunctionPointer SWIFT_WARN_UNUSED_RESULT;
@objc func returnsFunctionPointerThatTakesFunctionPointer() ->
@convention(c) (_ comparator: @convention(c) (_ x: Int, _ y: Int) -> Int) -> Void {
fatalError()
Expand Down
2 changes: 1 addition & 1 deletion test/PrintAsObjC/cdecl-imports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Foundation
public func fwdDeclaresBee() -> Bee { fatalError() }

// CHECK: @class Hive;
// CHECK-LABEL: void fwd_declares_hive(Hive * _Nonnull (* _Nonnull bzzz)(Bee * _Nonnull));
// CHECK-LABEL: void fwd_declares_hive(SWIFT_NOESCAPE Hive * _Nonnull (* _Nonnull bzzz)(Bee * _Nonnull));

@_cdecl("fwd_declares_hive")
public func fwdDeclaresHive(bzzz: @convention(c) (Bee) -> Hive) { fatalError() }
Expand Down
4 changes: 2 additions & 2 deletions test/PrintAsObjC/cdecl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public func block_recurring_nightmare(x: @escaping @convention(block) (@conventi
@_cdecl("foo_bar")
func foo(x: Int, bar y: Int) {}

// CHECK-LABEL: SWIFT_EXTERN double (* _Nonnull function_pointer_nightmare(float (* _Nonnull x)(NSInteger)))(char) SWIFT_WARN_UNUSED_RESULT;
// CHECK-LABEL: SWIFT_EXTERN double (* _Nonnull function_pointer_nightmare(SWIFT_NOESCAPE float (* _Nonnull x)(NSInteger)))(char) SWIFT_WARN_UNUSED_RESULT;
@_cdecl("function_pointer_nightmare")
func function_pointer_nightmare(x: @convention(c) (Int) -> Float)
-> @convention(c) (CChar) -> Double { return { _ in 0 } }

// CHECK-LABEL: SWIFT_EXTERN double (* _Nonnull function_pointer_recurring_nightmare(float (* _Nonnull x)(NSInteger (* _Nonnull)(double))))(char (* _Nonnull)(unsigned char)) SWIFT_WARN_UNUSED_RESULT;
// CHECK-LABEL: SWIFT_EXTERN double (* _Nonnull function_pointer_recurring_nightmare(float (* _Nonnull x)(SWIFT_NOESCAPE NSInteger (* _Nonnull)(double))))(SWIFT_NOESCAPE char (* _Nonnull)(unsigned char)) SWIFT_WARN_UNUSED_RESULT;
@_cdecl("function_pointer_recurring_nightmare")
public func function_pointer_recurring_nightmare(x: @escaping @convention(c) (@convention(c) (Double) -> Int) -> Float)
-> @convention(c) (@convention(c) (CUnsignedChar) -> CChar) -> Double {
Expand Down
6 changes: 3 additions & 3 deletions test/SIL/clang-function-types-nonwindows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import ctypes

public func f(g: @convention(c, cType: "void (*)(size_t)") (Int) -> ()) { g(0) }

// CHECK: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") (Int) -> ()) -> () {
// CHECK: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") (Int) -> ()):
// CHECK: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") (Int) -> (), let, name "g", argno 1 // id: %1
// CHECK: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()) -> () {
// CHECK: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()):
// CHECK: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1
12 changes: 8 additions & 4 deletions test/SILGen/async_builtins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public func usesWithUnsafeContinuation() async {
let _: Int = await Builtin.withUnsafeContinuation { c in }

// CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[FN]]
// CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]]
// CHECK: [[BOX:%.*]] = alloc_stack $Int
// CHECK: [[CC:%.*]] = get_async_continuation_addr Int, [[BOX]] : $*Int
// CHECK: apply [[CLOSURE]]([[CC]]) : $@noescape @callee_guaranteed (Builtin.RawUnsafeContinuation) -> ()
Expand All @@ -57,7 +58,8 @@ public func usesWithUnsafeContinuation() async {
let _: String = await Builtin.withUnsafeContinuation { c in }

// CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU0_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[FN]]
// CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]]
// CHECK: [[BOX:%.*]] = alloc_stack $String
// CHECK: [[CC:%.*]] = get_async_continuation_addr String, [[BOX]] : $*String
// CHECK: apply [[CLOSURE]]([[CC]]) : $@noescape @callee_guaranteed (Builtin.RawUnsafeContinuation) -> ()
Expand All @@ -72,7 +74,8 @@ public func usesWithUnsafeContinuation() async {
let _: Any = await Builtin.withUnsafeContinuation { c in }

// CHECK: [[FN:%.*]] = function_ref @$s4test26usesWithUnsafeContinuationyyYaFyBcXEfU1_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[FN]]
// CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]]
// CHECK: [[BOX:%.*]] = alloc_stack $Any
// CHECK: [[CC:%.*]] = get_async_continuation_addr Any, [[BOX]] : $*Any
// CHECK: apply [[CLOSURE]]([[CC]]) : $@noescape @callee_guaranteed (Builtin.RawUnsafeContinuation) -> ()
Expand All @@ -91,7 +94,8 @@ public func usesWithUnsafeThrowingContinuation() async throws {
let _: Int = try await Builtin.withUnsafeThrowingContinuation { c in }

// CHECK: [[FN:%.*]] = function_ref @$s4test34usesWithUnsafeThrowingContinuationyyYaKFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[FN]]
// CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> ()
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]]
// CHECK: [[BOX:%.*]] = alloc_stack $Int
// CHECK: [[CC:%.*]] = get_async_continuation_addr [throws] Int, [[BOX]] : $*Int
// CHECK: apply [[CLOSURE]]([[CC]]) : $@noescape @callee_guaranteed (Builtin.RawUnsafeContinuation) -> ()
Expand Down
3 changes: 2 additions & 1 deletion test/SILGen/auto_closures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func test_auto_closure_with_capture(_ x: Bool) -> Bool {
// CHECK-LABEL: sil hidden [ossa] @$s13auto_closures05test_A24_closure_without_capture{{[_0-9a-zA-Z]*}}F
func test_auto_closure_without_capture() -> Bool {
// CHECK: [[CLOSURE:%.*]] = function_ref @$s13auto_closures05test_A24_closure_without_capture
// CHECK: [[THICK:%.*]] = thin_to_thick_function [[CLOSURE]] : $@convention(thin) () -> Bool to $@noescape @callee_guaranteed () -> Bool
// CHECK: [[CVT:%.*]] = convert_function [[CLOSURE]]
// CHECK: [[THICK:%.*]] = thin_to_thick_function [[CVT]] : $@convention(thin) @noescape () -> Bool to $@noescape @callee_guaranteed () -> Bool
// CHECK: [[RET:%.*]] = apply {{%.*}}([[THICK]])
// CHECK: return [[RET]]
return call_auto_closure(false_)
Expand Down
16 changes: 10 additions & 6 deletions test/SILGen/c_function_pointers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func calls(_ arg: @convention(c) (Int) -> Int, _ x: Int) -> Int {
return arg(x)
}
// CHECK-LABEL: sil hidden [ossa] @$s19c_function_pointers5callsyS3iXC_SitF
// CHECK: bb0(%0 : $@convention(c) (Int) -> Int, %1 : $Int):
// CHECK: bb0(%0 : $@convention(c) @noescape (Int) -> Int, %1 : $Int):
// CHECK: [[RESULT:%.*]] = apply %0(%1)
// CHECK: return [[RESULT]]

Expand All @@ -60,20 +60,24 @@ func pointers_to_swift_functions(_ x: Int) {
func local(_ y: Int) -> Int { return y }

// CHECK: [[GLOBAL_C:%.*]] = function_ref @$s19c_function_pointers6globalyS2iFTo
// CHECK: apply {{.*}}([[GLOBAL_C]], [[X]])
// CHECK: [[CVT:%.*]] = convert_function [[GLOBAL_C]]
// CHECK: apply {{.*}}([[CVT]], [[X]])
calls(global, x)

// CHECK: [[LOCAL_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiF5localL_yS2iFTo
// CHECK: apply {{.*}}([[LOCAL_C]], [[X]])
// CHECK: [[CVT:%.*]] = convert_function [[LOCAL_C]]
// CHECK: apply {{.*}}([[CVT]], [[X]])
calls(local, x)

// CHECK: [[CLOSURE_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiFS2icfU_To
// CHECK: apply {{.*}}([[CLOSURE_C]], [[X]])
// CHECK: [[CLOSURE_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiFS2iXEfU_To
// CHECK: [[CVT:%.*]] = convert_function [[CLOSURE_C]]
// CHECK: apply {{.*}}([[CVT]], [[X]])
calls({ $0 + 1 }, x)

calls_no_args(no_args)
// CHECK: [[NO_ARGS_C:%.*]] = function_ref @$s19c_function_pointers7no_argsSiyFTo
// CHECK: apply {{.*}}([[NO_ARGS_C]])
// CHECK: [[CVT:%.*]] = convert_function [[NO_ARGS_C]]
// CHECK: apply {{.*}}([[CVT]])
}

func unsupported(_ a: Any) -> Int { return 0 }
Expand Down
3 changes: 2 additions & 1 deletion test/SILGen/closures_callee_guaranteed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public func apply(_ f : () -> Int) -> Int {

// CHECK-LABEL: sil [ossa] @{{.*}}test{{.*}} : $@convention(thin) () -> ()
// CHECK: [[C1:%.*]] = function_ref @{{.*}}test{{.*}} : $@convention(thin) () -> Int
// CHECK: [[C3:%.*]] = thin_to_thick_function [[C1]] : $@convention(thin) () -> Int to $@noescape @callee_guaranteed () -> Int
// CHECK: [[C2:%.*]] = convert_function [[C1]] : $@convention(thin) () -> Int to $@convention(thin) @noescape () -> Int
// CHECK: [[C3:%.*]] = thin_to_thick_function [[C2]] : $@convention(thin) @noescape () -> Int to $@noescape @callee_guaranteed () -> Int
// CHECK: [[A:%.*]] = function_ref @{{.*}}apply{{.*}} : $@convention(thin) (@noescape @callee_guaranteed () -> Int) -> Int
// CHECK: apply [[A]]([[C3]]) : $@convention(thin) (@noescape @callee_guaranteed () -> Int) -> Int
public func test() {
Expand Down
8 changes: 5 additions & 3 deletions test/SILGen/objc_blocks_bridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import Foundation
}

// CHECK-LABEL: sil hidden [thunk] [ossa] @$s20objc_blocks_bridging3FooC16cFunctionPointer{{[_0-9a-zA-Z]*}}FTo
// CHECK: bb0([[F:%.*]] : $@convention(c) (Int) -> Int, [[X:%.*]] : $Int, [[SELF:%.*]] : @unowned $Foo):
// CHECK: bb0([[F:%.*]] : $@convention(c) @noescape (Int) -> Int, [[X:%.*]] : $Int, [[SELF:%.*]] : @unowned $Foo):
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
// CHECK: [[BORROWED_SELF_COPY:%.*]] = begin_borrow [[SELF_COPY]]
// CHECK: [[NATIVE:%.*]] = function_ref @$s20objc_blocks_bridging3FooC16cFunctionPointer{{[_0-9a-zA-Z]*}}F
Expand Down Expand Up @@ -175,7 +175,8 @@ func bridgeNonnullBlockResult() {
// CHECK-LABEL: sil hidden [ossa] @$s20objc_blocks_bridging19bridgeNoescapeBlock2fn5optFnyyyXE_yycSgtF
func bridgeNoescapeBlock(fn: () -> (), optFn: (() -> ())?) {
// CHECK: [[CLOSURE_FN:%.*]] = function_ref @$s20objc_blocks_bridging19bridgeNoescapeBlock2fn5optFnyyyXE_yycSgtFyyXEfU_
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CLOSURE_FN]]
// CHECK: [[CONV_FN:%.*]] = convert_function [[CLOSURE_FN]]
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CONV_FN]]
// without actually escaping sentinel
// CHECK: [[WAE_THUNK:%.*]] = function_ref @$sIg_Ieg_TR
// CHECK: [[WAE_PA:%.*]] = partial_apply [callee_guaranteed] [[WAE_THUNK]]([[THICK_FN]])
Expand Down Expand Up @@ -223,7 +224,8 @@ func bridgeNoescapeBlock(fn: () -> (), optFn: (() -> ())?) {
noescapeBlock(nil)

// CHECK: [[CLOSURE_FN:%.*]] = function_ref @$s20objc_blocks_bridging19bridgeNoescapeBlock2fn5optFnyyyXE_yycSgtF
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CLOSURE_FN]]
// CHECK: [[CONV_FN:%.*]] = convert_function [[CLOSURE_FN]]
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CONV_FN]]
// CHECK: [[WAE_THUNK:%.*]] = function_ref @$sIg_Ieg_TR
// CHECK: [[WAE_PA:%.*]] = partial_apply [callee_guaranteed] [[WAE_THUNK]]([[THICK_FN]])
// CHECK: [[WAE_MD:%.*]] = mark_dependence [[WAE_PA]] : $@callee_guaranteed () -> () on [[THICK_FN]]
Expand Down
9 changes: 6 additions & 3 deletions test/SILGen/parameterized_existentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func use(_ k: (S) -> Void) {}
// CHECK-LABEL: sil hidden [ossa] @$s13parameterized11upcastInputyyF : $@convention(thin) () -> () {
func upcastInput() {
// CHECK: [[P_FN:%.*]] = function_ref @$s13parameterized11upcastInputyyFyAA1P_pXEfU_ : $@convention(thin) (@in_guaranteed P) -> ()
// CHECK: [[THICK_P_FN:%.*]] = thin_to_thick_function [[P_FN]] : $@convention(thin) (@in_guaranteed P) -> () to $@noescape @callee_guaranteed (@in_guaranteed P) -> ()
// CHECK: [[NOESCAPE_P_FN:%.*]] = convert_function [[P_FN]] : $@convention(thin) (@in_guaranteed P) -> () to $@convention(thin) @noescape (@in_guaranteed P) -> ()
// CHECK: [[THICK_P_FN:%.*]] = thin_to_thick_function [[NOESCAPE_P_FN]] : $@convention(thin) @noescape (@in_guaranteed P) -> () to $@noescape @callee_guaranteed (@in_guaranteed P) -> ()
// CHECK: [[S_TO_P_THUNK_FN:%.*]] = function_ref @$s13parameterized1P_pIgn_AA1SVIegy_TR : $@convention(thin) (S, @noescape @callee_guaranteed (@in_guaranteed P) -> ()) -> ()
// CHECK: [[PARTIAL_INT_THUNK_FN:%.*]] = partial_apply [callee_guaranteed] [[S_TO_P_THUNK_FN]]([[THICK_P_FN]]) : $@convention(thin) (S, @noescape @callee_guaranteed (@in_guaranteed P) -> ()) -> ()
// CHECK: [[NOESCAPE_P_THUNK_FN:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PARTIAL_INT_THUNK_FN]] : $@callee_guaranteed (S) -> () to $@noescape @callee_guaranteed (S) -> ()
Expand All @@ -69,7 +70,8 @@ func reuse(_ k: () -> any P<Int, String, Float>) {}
// CHECK-LABEL: sil hidden [ossa] @$s13parameterized12upcastResultyyF : $@convention(thin) () -> () {
func upcastResult() {
// CHECK: [[RES_FN:%.*]] = function_ref @$s13parameterized12upcastResultyyFAA1SVyXEfU_ : $@convention(thin) () -> S
// CHECK: [[THICK_RES_FN:%.*]] = thin_to_thick_function [[RES_FN]] : $@convention(thin) () -> S to $@noescape @callee_guaranteed () -> S
// CHECK: [[NOESCAPE_RES_FN:%.*]] = convert_function [[RES_FN]] : $@convention(thin) () -> S to $@convention(thin) @noescape () -> S
// CHECK: [[THICK_RES_FN:%.*]] = thin_to_thick_function [[NOESCAPE_RES_FN]] : $@convention(thin) @noescape () -> S to $@noescape @callee_guaranteed () -> S
// CHECK: [[S_TO_P_RES_THUNK_FN:%.*]] = function_ref @$s13parameterized1SVIgd_AA1P_pySiSSSfXPIegr_TR : $@convention(thin) (@noescape @callee_guaranteed () -> S) -> @out P<Int, String, Float>
// CHECK: [[PARTIAL_RES_THUNK_FN:%.*]] = partial_apply [callee_guaranteed] [[S_TO_P_RES_THUNK_FN]]([[THICK_RES_FN]]) : $@convention(thin) (@noescape @callee_guaranteed () -> S) -> @out P<Int, String, Float>
// CHECK: [[NOESCAPE_RES_THUNK_FN:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PARTIAL_RES_THUNK_FN]] : $@callee_guaranteed () -> @out P<Int, String, Float> to $@noescape @callee_guaranteed () -> @out P<Int, String, Float>
Expand All @@ -79,7 +81,8 @@ func upcastResult() {
reuse({ () -> S in S() })

// CHECK: [[RES_Q_FN:%.*]] = function_ref @$s13parameterized12upcastResultyyFAA1Q_pySiSSSfXPyXEfU0_ : $@convention(thin) () -> @out Q<Int, String, Float>
// CHECK: [[THICK_NOESCAPE_RES_Q_FN:%.*]] = thin_to_thick_function [[RES_Q_FN]] : $@convention(thin) () -> @out Q<Int, String, Float> to $@noescape @callee_guaranteed () -> @out Q<Int, String, Float>
// CHECK: [[NOESCAPE_RES_Q_FN:%.*]] = convert_function [[RES_Q_FN]] : $@convention(thin) () -> @out Q<Int, String, Float> to $@convention(thin) @noescape () -> @out Q<Int, String, Float>
// CHECK: [[THICK_NOESCAPE_RES_Q_FN:%.*]] = thin_to_thick_function [[NOESCAPE_RES_Q_FN]] : $@convention(thin) @noescape () -> @out Q<Int, String, Float> to $@noescape @callee_guaranteed () -> @out Q<Int, String, Float>
// CHECK: [[P_TO_Q_RES_THUNK_FN:%.*]] = function_ref @$s13parameterized1Q_pySiSSSfXPIgr_AA1P_pySiSSSfXPIegr_TR : $@convention(thin) (@noescape @callee_guaranteed () -> @out Q<Int, String, Float>) -> @out P<Int, String, Float>
// CHECK: [[PARTIAL_P_TO_Q_RES_THUNK_FN:%.*]] = partial_apply [callee_guaranteed] [[P_TO_Q_RES_THUNK_FN]]([[THICK_NOESCAPE_RES_Q_FN]]) : $@convention(thin) (@noescape @callee_guaranteed () -> @out Q<Int, String, Float>) -> @out P<Int, String, Float>
// CHECK: [[NOESCAPE_PARTIAL_P_TO_Q_RES_THUNK_FN:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PARTIAL_P_TO_Q_RES_THUNK_FN]] : $@callee_guaranteed () -> @out P<Int, String, Float> to $@noescape @callee_guaranteed () -> @out P<Int, String, Float>
Expand Down
Loading