Skip to content

Commit bc1fc73

Browse files
committed
Sema: Simpler materializeForSet return type, NFC
The function pointer is a thin function and possibly polymorphic, so it does not really have an AST type. Instead of pretending it has an AST type, just return a RawPointer and remove some casts in the process.
1 parent cfebe49 commit bc1fc73

14 files changed

+103
-182
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ namespace {
949949

950950
SILBasicBlock *contBB = gen.createBasicBlock();
951951
SILBasicBlock *writebackBB = gen.createBasicBlock(gen.B.getInsertionBB());
952+
952953
gen.B.createSwitchEnum(loc, materialized.callback, /*defaultDest*/ nullptr,
953954
{ { ctx.getOptionalSomeDecl(), writebackBB },
954955
{ ctx.getOptionalNoneDecl(), contBB } });
@@ -961,22 +962,19 @@ namespace {
961962
SILType::getPrimitiveObjectType(TupleType::getEmpty(ctx));
962963
auto rawPointerTy = SILType::getRawPointerType(ctx);
963964

964-
SILType callbackSILType = gen.getLoweredType(
965-
materialized.callback->getType().getSwiftRValueType()
966-
.getAnyOptionalObjectType());
967-
968965
// The callback is a BB argument from the switch_enum.
969966
SILValue callback =
970-
writebackBB->createBBArg(callbackSILType);
967+
writebackBB->createBBArg(rawPointerTy);
971968

972969
// Cast the callback to the correct polymorphic function type.
973970
auto origCallbackFnType = gen.SGM.Types.getMaterializeForSetCallbackType(
974971
decl, materialized.genericSig, materialized.origSelfType);
975972
auto origCallbackType = SILType::getPrimitiveObjectType(origCallbackFnType);
973+
callback = gen.B.createPointerToThinFunction(loc, callback, origCallbackType);
974+
976975
auto substCallbackFnType = origCallbackFnType->substGenericArgs(
977976
M, M.getSwiftModule(), substitutions);
978977
auto substCallbackType = SILType::getPrimitiveObjectType(substCallbackFnType);
979-
980978
auto metatypeType = substCallbackFnType->getParameters().back().getSILType();
981979

982980
// We need to borrow the base here. We can't just consume it
@@ -1011,9 +1009,6 @@ namespace {
10111009
materialized.temporary.getValue(),
10121010
rawPointerTy);
10131011

1014-
callback = gen.B.createThinFunctionToPointer(loc, callback, rawPointerTy);
1015-
callback = gen.B.createPointerToThinFunction(loc, callback, origCallbackType);
1016-
10171012
// Apply the callback.
10181013
gen.B.createApply(loc, callback, substCallbackType,
10191014
emptyTupleTy, substitutions, {

lib/SILGen/SILGenMaterializeForSet.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -457,23 +457,12 @@ void MaterializeForSetEmitter::emit(SILGenFunction &gen) {
457457
// Form the callback.
458458
SILValue callback;
459459
if (callbackFn) {
460-
// Make a reference to the function.
460+
// Make a reference to the callback.
461461
callback = gen.B.createFunctionRef(loc, callbackFn);
462-
463-
// If it's polymorphic, cast to RawPointer and then back to the
464-
// right monomorphic type. The safety of this cast relies on some
465-
// assumptions about what exactly IRGen can reconstruct from the
466-
// callback's thick type argument.
467-
if (callbackFn->getLoweredFunctionType()->isPolymorphic()) {
468-
callback = gen.B.createThinFunctionToPointer(loc, callback, rawPointerTy);
469-
470-
OptionalTypeKind optKind;
471-
auto callbackTy = optCallbackTy.getAnyOptionalObjectType(SGM.M, optKind);
472-
callback = gen.B.createPointerToThinFunction(loc, callback, callbackTy);
473-
}
474-
462+
callback = gen.B.createThinFunctionToPointer(loc, callback, rawPointerTy);
475463
callback = gen.B.createOptionalSome(loc, callback, optCallbackTy);
476464
} else {
465+
// There is no callback.
477466
callback = gen.B.createOptionalNone(loc, optCallbackTy);
478467
}
479468

@@ -548,7 +537,8 @@ collectIndicesFromParameters(SILGenFunction &gen, SILLocation loc,
548537
return result;
549538
}
550539

551-
SILFunction *MaterializeForSetEmitter::createCallback(SILFunction &F, GeneratorFn generator) {
540+
SILFunction *MaterializeForSetEmitter::createCallback(SILFunction &F,
541+
GeneratorFn generator) {
552542
auto callbackType =
553543
SGM.Types.getMaterializeForSetCallbackType(WitnessStorage,
554544
GenericSig,

lib/Sema/CodeSynthesis.cpp

Lines changed: 8 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -204,35 +204,6 @@ static FuncDecl *createSetterPrototype(AbstractStorageDecl *storage,
204204
return setter;
205205
}
206206

207-
/// Returns the type of the self argument of a materializeForSet
208-
/// callback. If we don't have a meaningful direct self type, just
209-
/// use something meaningless and hope it doesn't matter.
210-
static Type getSelfTypeForMaterializeForSetCallback(ASTContext &ctx,
211-
DeclContext *DC,
212-
bool isStatic) {
213-
Type selfType = DC->getDeclaredTypeInContext();
214-
if (!selfType) {
215-
// This restriction is theoretically liftable by writing the necessary
216-
// contextual information into the callback storage.
217-
assert(!DC->isGenericContext() &&
218-
"no enclosing type for generic materializeForSet; callback "
219-
"will not be able to bind type arguments!");
220-
return TupleType::getEmpty(ctx);
221-
}
222-
223-
// If we're in a protocol, we want to actually use the Self type.
224-
if (selfType->is<ProtocolType>()) {
225-
selfType = DC->getProtocolSelf()->getArchetype();
226-
}
227-
228-
// Use the metatype if this is a static member.
229-
if (isStatic) {
230-
return MetatypeType::get(selfType, ctx);
231-
} else {
232-
return selfType;
233-
}
234-
}
235-
236207
// True if the storage is dynamic or imported from Objective-C. In these cases,
237208
// we need to emit a static materializeForSet thunk that dynamically dispatches
238209
// to 'get' and 'set', rather than the normal dynamically dispatched
@@ -254,44 +225,6 @@ bool needsToBeRegisteredAsExternalDecl(AbstractStorageDecl *storage) {
254225
return nominal->hasClangNode();
255226
}
256227

257-
static Type createMaterializeForSetReturnType(AbstractStorageDecl *storage,
258-
TypeChecker &TC) {
259-
auto &ctx = storage->getASTContext();
260-
SourceLoc loc = storage->getLoc();
261-
262-
auto DC = storage->getDeclContext();
263-
264-
if (DC->getDeclaredTypeInContext() &&
265-
DC->getDeclaredTypeInContext()->is<ErrorType>()) {
266-
return ErrorType::get(ctx);
267-
}
268-
269-
Type callbackSelfType =
270-
getSelfTypeForMaterializeForSetCallback(ctx, DC, storage->isStatic());
271-
TupleTypeElt callbackArgs[] = {
272-
ctx.TheRawPointerType,
273-
InOutType::get(ctx.TheUnsafeValueBufferType),
274-
InOutType::get(callbackSelfType),
275-
MetatypeType::get(callbackSelfType, MetatypeRepresentation::Thick),
276-
};
277-
auto callbackExtInfo = FunctionType::ExtInfo()
278-
.withRepresentation(FunctionType::Representation::Thin);
279-
auto callbackType = FunctionType::get(TupleType::get(callbackArgs, ctx),
280-
TupleType::getEmpty(ctx),
281-
callbackExtInfo);
282-
283-
// Try to make the callback type optional. Don't crash if it doesn't
284-
// work, though.
285-
auto optCallbackType = TC.getOptionalType(loc, callbackType);
286-
if (!optCallbackType) optCallbackType = callbackType;
287-
288-
TupleTypeElt retElts[] = {
289-
{ ctx.TheRawPointerType },
290-
{ optCallbackType },
291-
};
292-
return TupleType::get(retElts, ctx);
293-
}
294-
295228
static FuncDecl *createMaterializeForSetPrototype(AbstractStorageDecl *storage,
296229
TypeChecker &TC) {
297230
auto &ctx = storage->getASTContext();
@@ -314,10 +247,15 @@ static FuncDecl *createMaterializeForSetPrototype(AbstractStorageDecl *storage,
314247
};
315248
params.push_back(buildIndexForwardingParamList(storage, bufferElements));
316249

317-
// The accessor returns (Builtin.RawPointer, (@convention(thin) (...) -> ())?),
250+
// The accessor returns (temporary: Builtin.RawPointer,
251+
// callback: Builtin.RawPointer),
318252
// where the first pointer is the materialized address and the
319-
// second is an optional callback.
320-
Type retTy = createMaterializeForSetReturnType(storage, TC);
253+
// second is the address of an optional callback.
254+
TupleTypeElt retElts[] = {
255+
{ ctx.TheRawPointerType },
256+
{ OptionalType::get(ctx.TheRawPointerType) },
257+
};
258+
Type retTy = TupleType::get(retElts, ctx);
321259

322260
auto *materializeForSet = FuncDecl::create(
323261
ctx, /*StaticLoc=*/SourceLoc(), StaticSpellingKind::None, loc,

test/SILGen/accessors.swift

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ func test0(ref: A) {
5656
// CHECK-NEXT: // function_ref accessors.OrdinarySub.subscript.setter : (Swift.Int) -> Swift.Int
5757
// CHECK-NEXT: [[T0:%.*]] = function_ref @_TFV9accessors11OrdinarySubs9subscriptFSiSi
5858
// CHECK-NEXT: apply [[T0]]([[VALUE]], [[INDEX0]], [[ADDR]])
59-
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout A, @thick A.Type) -> ()>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
60-
// CHECK: [[WRITEBACK]]([[CALLBACK:%.*]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout A, @thick A.Type) -> ()):
59+
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<Builtin.RawPointer>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
60+
// CHECK: [[WRITEBACK]]([[CALLBACK_ADDR:%.*]] : $Builtin.RawPointer):
61+
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout A, @thick A.Type) -> ()
6162
// CHECK-NEXT: [[TEMP2:%.*]] = alloc_stack $A
6263
// CHECK-NEXT: store %0 to [[TEMP2]] : $*A
6364
// CHECK-NEXT: [[T0:%.*]] = metatype $@thick A.Type
6465
// CHECK-NEXT: [[T1:%.*]] = address_to_pointer [[ADDR]] : $*OrdinarySub to $Builtin.RawPointer
65-
// CHECK-NEXT: [[CALLBACK_ADDR:%.*]] = thin_function_to_pointer [[CALLBACK]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout A, @thick A.Type) -> () to $Builtin.RawPointer
66-
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout A, @thick A.Type) -> ()
6766
// CHECK-NEXT: apply [[CALLBACK]]([[T1]], [[STORAGE]], [[TEMP2]], [[T0]])
6867
// CHECK-NEXT: dealloc_stack [[TEMP2]]
6968
// CHECK-NEXT: br [[CONT]]
@@ -113,14 +112,13 @@ func test1(ref: B) {
113112
// CHECK-NEXT: // function_ref accessors.MutatingSub.subscript.getter : (Swift.Int) -> Swift.Int
114113
// CHECK-NEXT: [[T0:%.*]] = function_ref @_TFV9accessors11MutatingSubg9subscriptFSiSi : $@convention(method) (Int, @inout MutatingSub) -> Int
115114
// CHECK-NEXT: [[VALUE:%.*]] = apply [[T0]]([[INDEX1]], [[ADDR]])
116-
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout B, @thick B.Type) -> ()>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
117-
// CHECK: [[WRITEBACK]]([[CALLBACK:%.*]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()):
115+
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<Builtin.RawPointer>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
116+
// CHECK: [[WRITEBACK]]([[CALLBACK_ADDR:%.*]] : $Builtin.RawPointer):
117+
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()
118118
// CHECK-NEXT: [[TEMP2:%.*]] = alloc_stack $B
119119
// CHECK-NEXT: store %0 to [[TEMP2]] : $*B
120120
// CHECK-NEXT: [[T0:%.*]] = metatype $@thick B.Type
121121
// CHECK-NEXT: [[T1:%.*]] = address_to_pointer [[ADDR]] : $*MutatingSub to $Builtin.RawPointer
122-
// CHECK-NEXT: [[CALLBACK_ADDR:%.*]] = thin_function_to_pointer [[CALLBACK]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> () to $Builtin.RawPointer
123-
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()
124122
// CHECK-NEXT: apply [[CALLBACK]]([[T1]], [[STORAGE]], [[TEMP2]], [[T0]])
125123
// CHECK-NEXT: dealloc_stack [[TEMP2]]
126124
// CHECK-NEXT: br [[CONT]]
@@ -138,14 +136,13 @@ func test1(ref: B) {
138136
// CHECK-NEXT: // function_ref accessors.MutatingSub.subscript.setter : (Swift.Int) -> Swift.Int
139137
// CHECK-NEXT: [[T0:%.*]] = function_ref @_TFV9accessors11MutatingSubs9subscriptFSiSi : $@convention(method) (Int, Int, @inout MutatingSub) -> ()
140138
// CHECK-NEXT: apply [[T0]]([[VALUE]], [[INDEX0]], [[ADDR]])
141-
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout B, @thick B.Type) -> ()>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
142-
// CHECK: [[WRITEBACK]]([[CALLBACK:%.*]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()):
139+
// CHECK-NEXT: switch_enum [[OPT_CALLBACK]] : $Optional<Builtin.RawPointer>, case #Optional.some!enumelt.1: [[WRITEBACK:bb[0-9]+]], case #Optional.none!enumelt: [[CONT:bb[0-9]+]]
140+
// CHECK: [[WRITEBACK]]([[CALLBACK_ADDR:%.*]] : $Builtin.RawPointer):
141+
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()
143142
// CHECK-NEXT: [[TEMP2:%.*]] = alloc_stack $B
144143
// CHECK-NEXT: store %0 to [[TEMP2]] : $*B
145144
// CHECK-NEXT: [[T0:%.*]] = metatype $@thick B.Type
146145
// CHECK-NEXT: [[T1:%.*]] = address_to_pointer [[ADDR]] : $*MutatingSub to $Builtin.RawPointer
147-
// CHECK-NEXT: [[CALLBACK_ADDR:%.*]] = thin_function_to_pointer [[CALLBACK]] : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> () to $Builtin.RawPointer
148-
// CHECK-NEXT: [[CALLBACK:%.*]] = pointer_to_thin_function [[CALLBACK_ADDR]] : $Builtin.RawPointer to $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout B, @thick B.Type) -> ()
149146
// CHECK-NEXT: apply [[CALLBACK]]([[T1]], [[STORAGE2]], [[TEMP2]], [[T0]])
150147
// CHECK-NEXT: dealloc_stack [[TEMP2]]
151148
// CHECK-NEXT: br [[CONT]]

test/SILGen/addressors.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ struct D : Subscriptable {
190190
// SILGEN: [[ADDR_TMP:%.*]] = struct_extract [[PTR]] : $UnsafeMutablePointer<Int32>,
191191
// SILGEN: [[ADDR:%.*]] = pointer_to_address [[ADDR_TMP]]
192192
// SILGEN: [[PTR:%.*]] = address_to_pointer [[ADDR]]
193-
// SILGEN: [[OPT:%.*]] = enum $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout D, @thick D.Type) -> ()>, #Optional.none!enumelt
194-
// SILGEN: [[T2:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[OPT]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout D, @thick D.Type) -> ()>)
193+
// SILGEN: [[OPT:%.*]] = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt
194+
// SILGEN: [[T2:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[OPT]] : $Optional<Builtin.RawPointer>)
195195
// SILGEN: return [[T2]] :
196196

197197
func make_int() -> Int32 { return 0 }
@@ -331,7 +331,7 @@ class G {
331331
// CHECK: strong_release [[OWNER]] : $Builtin.NativeObject
332332

333333
// materializeForSet for G.value
334-
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Gm5valueVs5Int32 : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed G) -> (Builtin.RawPointer, Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>) {
334+
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Gm5valueVs5Int32 : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed G) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
335335
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $G):
336336
// Call the addressor.
337337
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Gao5valueVs5Int32 : $@convention(method) (@guaranteed G) -> (UnsafeMutablePointer<Int32>, @owned Builtin.NativeObject)
@@ -348,9 +348,10 @@ class G {
348348
// CHECK: [[PTR:%.*]] = address_to_pointer [[ADDR]]
349349
// Set up the callback.
350350
// CHECK: [[CALLBACK_FN:%.*]] = function_ref @_TFFC10addressors1Gm5valueVs5Int32U_T_ :
351-
// CHECK: [[CALLBACK:%.*]] = enum $Optional<{{.*}}>, #Optional.some!enumelt.1, [[CALLBACK_FN]]
351+
// CHECK: [[CALLBACK_ADDR:%.*]] = thin_function_to_pointer [[CALLBACK_FN]]
352+
// CHECK: [[CALLBACK:%.*]] = enum $Optional<Builtin.RawPointer>, #Optional.some!enumelt.1, [[CALLBACK_ADDR]]
352353
// Epilogue.
353-
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>)
354+
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<Builtin.RawPointer>)
354355
// CHECK: return [[RESULT]]
355356

356357
// materializeForSet callback for G.value
@@ -449,7 +450,7 @@ class I {
449450
// CHECK: store [[VALUE]] to [[T2]] : $*Int32
450451
// CHECK: strong_unpin [[OWNER]] : $Optional<Builtin.NativeObject>
451452

452-
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Im5valueVs5Int32 : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed I) -> (Builtin.RawPointer, Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout I, @thick I.Type) -> ()>) {
453+
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Im5valueVs5Int32 : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed I) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
453454
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $I):
454455
// Call the addressor.
455456
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Iap5valueVs5Int32 : $@convention(method) (@guaranteed I) -> (UnsafeMutablePointer<Int32>, @owned Optional<Builtin.NativeObject>)
@@ -466,9 +467,10 @@ class I {
466467
// CHECK: [[PTR:%.*]] = address_to_pointer [[ADDR]]
467468
// Set up the callback.
468469
// CHECK: [[CALLBACK_FN:%.*]] = function_ref @_TFFC10addressors1Im5valueVs5Int32U_T_ :
469-
// CHECK: [[CALLBACK:%.*]] = enum $Optional<{{.*}}>, #Optional.some!enumelt.1, [[CALLBACK_FN]]
470+
// CHECK: [[CALLBACK_ADDR:%.*]] = thin_function_to_pointer [[CALLBACK_FN]]
471+
// CHECK: [[CALLBACK:%.*]] = enum $Optional<Builtin.RawPointer>, #Optional.some!enumelt.1, [[CALLBACK_ADDR]]
470472
// Epilogue.
471-
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<@convention(thin) (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout I, @thick I.Type) -> ()>)
473+
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<Builtin.RawPointer>)
472474
// CHECK: return [[RESULT]]
473475

474476
// materializeForSet callback for I.value

0 commit comments

Comments
 (0)