Skip to content

Commit 5c5e80c

Browse files
authored
Merge pull request #42466 from apple/revert-42189-escape-c-pointer
Revert "[DebugInfo] Ignore noescape bit for all @convention(c) pointers"
2 parents 6b6fa8d + 36c951d commit 5c5e80c

22 files changed

+83
-83
lines changed

include/swift/AST/ExtInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ class ASTExtInfoBuilder {
358358

359359
constexpr Representation getRepresentation() const {
360360
unsigned rawRep = bits & RepresentationMask;
361+
assert(rawRep <= unsigned(Representation::Last) &&
362+
"unexpected SIL representation");
361363
return Representation(rawRep);
362364
}
363365

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "swift/AST/DiagnosticsSema.h"
2525
#include "swift/AST/DistributedDecl.h"
2626
#include "swift/AST/ExistentialLayout.h"
27-
#include "swift/AST/ExtInfo.h"
2827
#include "swift/AST/FileUnit.h"
2928
#include "swift/AST/ForeignAsyncConvention.h"
3029
#include "swift/AST/ForeignErrorConvention.h"
@@ -3682,16 +3681,6 @@ FunctionType *FunctionType::get(ArrayRef<AnyFunctionType::Param> params,
36823681
auto properties = getFunctionRecursiveProperties(params, result, globalActor);
36833682
auto arena = getArena(properties);
36843683

3685-
if (info.hasValue()) {
3686-
// Canonicalize all thin functions to be escaping (to keep compatibility
3687-
// with generic parameters). Note that one can pass SIL-level representation
3688-
// here, so we need additional check for maximum non-SIL value.
3689-
Representation rep = info.getValue().getRepresentation();
3690-
if (rep <= FunctionTypeRepresentation::Last &&
3691-
isThinRepresentation(rep))
3692-
info = info->withNoEscape(false);
3693-
}
3694-
36953684
llvm::FoldingSetNodeID id;
36963685
FunctionType::Profile(id, params, result, info);
36973686

@@ -4109,10 +4098,6 @@ CanSILFunctionType SILFunctionType::get(
41094098
ext = ext.intoBuilder().withClangFunctionType(nullptr).build();
41104099
}
41114100

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

41174102
llvm::FoldingSetNodeID id;
41184103
SILFunctionType::Profile(id, genericSig, ext, coroutineKind, callee, params,

test/AutoDiff/SILOptimizer/activity_analysis.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,14 @@ func testTryApply(_ x: Float) -> Float {
552552
// CHECK: bb0:
553553
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
554554
// CHECK: [NONE] // function_ref closure #1 in testTryApply(_:)
555-
// CHECK: [NONE] %3 = thin_to_thick_function %2 : $@convention(thin) () -> () to $@noescape @callee_guaranteed () -> ()
556-
// CHECK: [NONE] %4 = convert_function %3 : $@noescape @callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> @error Error
555+
// CHECK: [NONE] %3 = convert_function %2 : $@convention(thin) () -> () to $@convention(thin) @noescape () -> ()
556+
// CHECK: [NONE] %4 = thin_to_thick_function %3 : $@convention(thin) @noescape () -> () to $@noescape @callee_guaranteed () -> ()
557+
// CHECK: [NONE] %5 = convert_function %4 : $@noescape @callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> @error Error
557558
// CHECK: [NONE] // function_ref rethrowing(_:)
558559
// CHECK: bb1:
559-
// CHECK: [NONE] %7 = argument of bb1 : $()
560+
// CHECK: [NONE] %8 = argument of bb1 : $()
560561
// CHECK: bb2:
561-
// CHECK: [NONE] %9 = argument of bb2 : $Error
562+
// CHECK: [NONE] %10 = argument of bb2 : $Error
562563

563564
//===----------------------------------------------------------------------===//
564565
// Coroutine differentiation (`begin_apply`)

test/IRGen/objc_retainAutoreleasedReturnValue.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public func test(_ dict: NSDictionary) {
3131
// CHECK: notail call i8* @llvm.objc.retainAutoreleasedReturnValue
3232
// CHECK: ret void
3333

34-
// OPT-LABEL: define {{.*}}swiftcc void @"$s34objc_retainAutoreleasedReturnValue10useClosureyySo12NSDictionaryC_yADXEtF09$s34objc_bcd16Value4testyySo12H10CFyADXEfU_Tf1nc_n"(%TSo12NSDictionaryC* %0)
34+
// OPT-LABEL: define {{.*}}swiftcc void @"$s34objc_retainAutoreleasedReturnValue4testyySo12NSDictionaryCFyADXEfU_"(%TSo12NSDictionaryC* %0)
3535
// OPT: entry:
3636
// OPT: call {{.*}}@objc_msgSend
3737
// OPT: notail call i8* @llvm.objc.retainAutoreleasedReturnValue

test/PrintAsObjC/blocks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ typealias MyBlockWithNoescapeParam = (() -> ()) -> Int
101101
) {
102102
}
103103

104-
// CHECK-NEXT: - (void (* _Nonnull)(NSInteger (* _Nonnull)(NSInteger, NSInteger)))returnsFunctionPointerThatTakesFunctionPointer SWIFT_WARN_UNUSED_RESULT;
104+
// CHECK-NEXT: - (void (* _Nonnull)(SWIFT_NOESCAPE NSInteger (* _Nonnull)(NSInteger, NSInteger)))returnsFunctionPointerThatTakesFunctionPointer SWIFT_WARN_UNUSED_RESULT;
105105
@objc func returnsFunctionPointerThatTakesFunctionPointer() ->
106106
@convention(c) (_ comparator: @convention(c) (_ x: Int, _ y: Int) -> Int) -> Void {
107107
fatalError()

test/PrintAsObjC/cdecl-imports.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Foundation
1818
public func fwdDeclaresBee() -> Bee { fatalError() }
1919

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

2323
@_cdecl("fwd_declares_hive")
2424
public func fwdDeclaresHive(bzzz: @convention(c) (Bee) -> Hive) { fatalError() }

test/PrintAsObjC/cdecl.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public func block_recurring_nightmare(x: @escaping @convention(block) (@conventi
2626
@_cdecl("foo_bar")
2727
func foo(x: Int, bar y: Int) {}
2828

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

34-
// CHECK-LABEL: SWIFT_EXTERN double (* _Nonnull function_pointer_recurring_nightmare(float (* _Nonnull x)(NSInteger (* _Nonnull)(double))))(char (* _Nonnull)(unsigned char)) SWIFT_WARN_UNUSED_RESULT;
34+
// 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;
3535
@_cdecl("function_pointer_recurring_nightmare")
3636
public func function_pointer_recurring_nightmare(x: @escaping @convention(c) (@convention(c) (Double) -> Int) -> Float)
3737
-> @convention(c) (@convention(c) (CUnsignedChar) -> CChar) -> Double {

test/SIL/clang-function-types-nonwindows.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import ctypes
77

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

10-
// CHECK: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") (Int) -> ()) -> () {
11-
// CHECK: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") (Int) -> ()):
12-
// CHECK: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") (Int) -> (), let, name "g", argno 1 // id: %1
10+
// CHECK: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()) -> () {
11+
// CHECK: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()):
12+
// CHECK: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1

test/SILGen/async_builtins.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public func usesWithUnsafeContinuation() async {
4343
let _: Int = await Builtin.withUnsafeContinuation { c in }
4444

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

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

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

9396
// CHECK: [[FN:%.*]] = function_ref @$s4test34usesWithUnsafeThrowingContinuationyyYaKFyBcXEfU_ : $@convention(thin) (Builtin.RawUnsafeContinuation) -> ()
94-
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[FN]]
97+
// CHECK: [[TMP:%.*]] = convert_function [[FN]] : $@convention(thin) (Builtin.RawUnsafeContinuation) -> () to $@convention(thin) @noescape (Builtin.RawUnsafeContinuation) -> ()
98+
// CHECK: [[CLOSURE:%.*]] = thin_to_thick_function [[TMP]]
9599
// CHECK: [[BOX:%.*]] = alloc_stack $Int
96100
// CHECK: [[CC:%.*]] = get_async_continuation_addr [throws] Int, [[BOX]] : $*Int
97101
// CHECK: apply [[CLOSURE]]([[CC]]) : $@noescape @callee_guaranteed (Builtin.RawUnsafeContinuation) -> ()

test/SILGen/auto_closures.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ func test_auto_closure_with_capture(_ x: Bool) -> Bool {
2525
// CHECK-LABEL: sil hidden [ossa] @$s13auto_closures05test_A24_closure_without_capture{{[_0-9a-zA-Z]*}}F
2626
func test_auto_closure_without_capture() -> Bool {
2727
// CHECK: [[CLOSURE:%.*]] = function_ref @$s13auto_closures05test_A24_closure_without_capture
28-
// CHECK: [[THICK:%.*]] = thin_to_thick_function [[CLOSURE]] : $@convention(thin) () -> Bool to $@noescape @callee_guaranteed () -> Bool
28+
// CHECK: [[CVT:%.*]] = convert_function [[CLOSURE]]
29+
// CHECK: [[THICK:%.*]] = thin_to_thick_function [[CVT]] : $@convention(thin) @noescape () -> Bool to $@noescape @callee_guaranteed () -> Bool
2930
// CHECK: [[RET:%.*]] = apply {{%.*}}([[THICK]])
3031
// CHECK: return [[RET]]
3132
return call_auto_closure(false_)

test/SILGen/c_function_pointers.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func calls(_ arg: @convention(c) (Int) -> Int, _ x: Int) -> Int {
4040
return arg(x)
4141
}
4242
// CHECK-LABEL: sil hidden [ossa] @$s19c_function_pointers5callsyS3iXC_SitF
43-
// CHECK: bb0(%0 : $@convention(c) (Int) -> Int, %1 : $Int):
43+
// CHECK: bb0(%0 : $@convention(c) @noescape (Int) -> Int, %1 : $Int):
4444
// CHECK: [[RESULT:%.*]] = apply %0(%1)
4545
// CHECK: return [[RESULT]]
4646

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

6262
// CHECK: [[GLOBAL_C:%.*]] = function_ref @$s19c_function_pointers6globalyS2iFTo
63-
// CHECK: apply {{.*}}([[GLOBAL_C]], [[X]])
63+
// CHECK: [[CVT:%.*]] = convert_function [[GLOBAL_C]]
64+
// CHECK: apply {{.*}}([[CVT]], [[X]])
6465
calls(global, x)
6566

6667
// CHECK: [[LOCAL_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiF5localL_yS2iFTo
67-
// CHECK: apply {{.*}}([[LOCAL_C]], [[X]])
68+
// CHECK: [[CVT:%.*]] = convert_function [[LOCAL_C]]
69+
// CHECK: apply {{.*}}([[CVT]], [[X]])
6870
calls(local, x)
6971

70-
// CHECK: [[CLOSURE_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiFS2icfU_To
71-
// CHECK: apply {{.*}}([[CLOSURE_C]], [[X]])
72+
// CHECK: [[CLOSURE_C:%.*]] = function_ref @$s19c_function_pointers0B19_to_swift_functionsyySiFS2iXEfU_To
73+
// CHECK: [[CVT:%.*]] = convert_function [[CLOSURE_C]]
74+
// CHECK: apply {{.*}}([[CVT]], [[X]])
7275
calls({ $0 + 1 }, x)
7376

7477
calls_no_args(no_args)
7578
// CHECK: [[NO_ARGS_C:%.*]] = function_ref @$s19c_function_pointers7no_argsSiyFTo
76-
// CHECK: apply {{.*}}([[NO_ARGS_C]])
79+
// CHECK: [[CVT:%.*]] = convert_function [[NO_ARGS_C]]
80+
// CHECK: apply {{.*}}([[CVT]])
7781
}
7882

7983
func unsupported(_ a: Any) -> Int { return 0 }

test/SILGen/closures_callee_guaranteed.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public func apply(_ f : () -> Int) -> Int {
2222

2323
// CHECK-LABEL: sil [ossa] @{{.*}}test{{.*}} : $@convention(thin) () -> ()
2424
// CHECK: [[C1:%.*]] = function_ref @{{.*}}test{{.*}} : $@convention(thin) () -> Int
25-
// CHECK: [[C3:%.*]] = thin_to_thick_function [[C1]] : $@convention(thin) () -> Int to $@noescape @callee_guaranteed () -> Int
25+
// CHECK: [[C2:%.*]] = convert_function [[C1]] : $@convention(thin) () -> Int to $@convention(thin) @noescape () -> Int
26+
// CHECK: [[C3:%.*]] = thin_to_thick_function [[C2]] : $@convention(thin) @noescape () -> Int to $@noescape @callee_guaranteed () -> Int
2627
// CHECK: [[A:%.*]] = function_ref @{{.*}}apply{{.*}} : $@convention(thin) (@noescape @callee_guaranteed () -> Int) -> Int
2728
// CHECK: apply [[A]]([[C3]]) : $@convention(thin) (@noescape @callee_guaranteed () -> Int) -> Int
2829
public func test() {

test/SILGen/objc_blocks_bridging.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import Foundation
6666
}
6767

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

225226
// CHECK: [[CLOSURE_FN:%.*]] = function_ref @$s20objc_blocks_bridging19bridgeNoescapeBlock2fn5optFnyyyXE_yycSgtF
226-
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CLOSURE_FN]]
227+
// CHECK: [[CONV_FN:%.*]] = convert_function [[CLOSURE_FN]]
228+
// CHECK: [[THICK_FN:%.*]] = thin_to_thick_function [[CONV_FN]]
227229
// CHECK: [[WAE_THUNK:%.*]] = function_ref @$sIg_Ieg_TR
228230
// CHECK: [[WAE_PA:%.*]] = partial_apply [callee_guaranteed] [[WAE_THUNK]]([[THICK_FN]])
229231
// CHECK: [[WAE_MD:%.*]] = mark_dependence [[WAE_PA]] : $@callee_guaranteed () -> () on [[THICK_FN]]

test/SILGen/parameterized_existentials.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func use(_ k: (S) -> Void) {}
5454
// CHECK-LABEL: sil hidden [ossa] @$s13parameterized11upcastInputyyF : $@convention(thin) () -> () {
5555
func upcastInput() {
5656
// CHECK: [[P_FN:%.*]] = function_ref @$s13parameterized11upcastInputyyFyAA1P_pXEfU_ : $@convention(thin) (@in_guaranteed P) -> ()
57-
// CHECK: [[THICK_P_FN:%.*]] = thin_to_thick_function [[P_FN]] : $@convention(thin) (@in_guaranteed P) -> () to $@noescape @callee_guaranteed (@in_guaranteed P) -> ()
57+
// CHECK: [[NOESCAPE_P_FN:%.*]] = convert_function [[P_FN]] : $@convention(thin) (@in_guaranteed P) -> () to $@convention(thin) @noescape (@in_guaranteed P) -> ()
58+
// CHECK: [[THICK_P_FN:%.*]] = thin_to_thick_function [[NOESCAPE_P_FN]] : $@convention(thin) @noescape (@in_guaranteed P) -> () to $@noescape @callee_guaranteed (@in_guaranteed P) -> ()
5859
// CHECK: [[S_TO_P_THUNK_FN:%.*]] = function_ref @$s13parameterized1P_pIgn_AA1SVIegy_TR : $@convention(thin) (S, @noescape @callee_guaranteed (@in_guaranteed P) -> ()) -> ()
5960
// 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) -> ()) -> ()
6061
// CHECK: [[NOESCAPE_P_THUNK_FN:%.*]] = convert_escape_to_noescape [not_guaranteed] [[PARTIAL_INT_THUNK_FN]] : $@callee_guaranteed (S) -> () to $@noescape @callee_guaranteed (S) -> ()
@@ -69,7 +70,8 @@ func reuse(_ k: () -> any P<Int, String, Float>) {}
6970
// CHECK-LABEL: sil hidden [ossa] @$s13parameterized12upcastResultyyF : $@convention(thin) () -> () {
7071
func upcastResult() {
7172
// CHECK: [[RES_FN:%.*]] = function_ref @$s13parameterized12upcastResultyyFAA1SVyXEfU_ : $@convention(thin) () -> S
72-
// CHECK: [[THICK_RES_FN:%.*]] = thin_to_thick_function [[RES_FN]] : $@convention(thin) () -> S to $@noescape @callee_guaranteed () -> S
73+
// CHECK: [[NOESCAPE_RES_FN:%.*]] = convert_function [[RES_FN]] : $@convention(thin) () -> S to $@convention(thin) @noescape () -> S
74+
// CHECK: [[THICK_RES_FN:%.*]] = thin_to_thick_function [[NOESCAPE_RES_FN]] : $@convention(thin) @noescape () -> S to $@noescape @callee_guaranteed () -> S
7375
// CHECK: [[S_TO_P_RES_THUNK_FN:%.*]] = function_ref @$s13parameterized1SVIgd_AA1P_pySiSSSfXPIegr_TR : $@convention(thin) (@noescape @callee_guaranteed () -> S) -> @out P<Int, String, Float>
7476
// 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>
7577
// 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>
@@ -79,7 +81,8 @@ func upcastResult() {
7981
reuse({ () -> S in S() })
8082

8183
// CHECK: [[RES_Q_FN:%.*]] = function_ref @$s13parameterized12upcastResultyyFAA1Q_pySiSSSfXPyXEfU0_ : $@convention(thin) () -> @out Q<Int, String, Float>
82-
// 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>
84+
// 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>
85+
// 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>
8386
// 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>
8487
// 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>
8588
// 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>

0 commit comments

Comments
 (0)