mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Reapply "Fix the closure specializer's handling of indirect result types."
This fix had nothing to do with any of the build failures. This reverts commit 86650e8d8298c5337c19786eef863025636d2eea. Swift SVN r24330
This commit is contained in:
@@ -241,7 +241,7 @@ static void rewriteApplyInst(ArgDescriptor &AD, SILFunction *NewF) {
|
|||||||
NewArgs.push_back(Arg);
|
NewArgs.push_back(Arg);
|
||||||
|
|
||||||
SILType LoweredType = NewF->getLoweredType();
|
SILType LoweredType = NewF->getLoweredType();
|
||||||
SILType ResultType = LoweredType.getFunctionInterfaceResultType();
|
SILType ResultType = LoweredType.castTo<SILFunctionType>()->getSILResult();
|
||||||
ApplyInst *NewAI = Builder.createApply(AD.AI->getLoc(), FRI, LoweredType,
|
ApplyInst *NewAI = Builder.createApply(AD.AI->getLoc(), FRI, LoweredType,
|
||||||
ResultType, ArrayRef<Substitution>(),
|
ResultType, ArrayRef<Substitution>(),
|
||||||
NewArgs, NewF->isTransparent());
|
NewArgs, NewF->isTransparent());
|
||||||
|
|||||||
@@ -26,3 +26,32 @@ bb0(%0 : $*P, %1 : $Int):
|
|||||||
destroy_addr %0 : $*P
|
destroy_addr %0 : $*P
|
||||||
return %8 : $Int
|
return %8 : $Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test a specialized closure's indirect result type.
|
||||||
|
// SIL verification should catch the incorrect type.
|
||||||
|
// rdar:://19321284
|
||||||
|
|
||||||
|
sil hidden [fragile] @callee : $@thin (Builtin.Word) -> () {
|
||||||
|
bb0(%0 : $Builtin.Word):
|
||||||
|
unreachable
|
||||||
|
}
|
||||||
|
|
||||||
|
sil hidden [fragile] @thunk : $@thin (@out (), @owned @callee_owned ()->()) -> () {
|
||||||
|
bb0(%0 : $*(), %1 : $@callee_owned () -> ()):
|
||||||
|
unreachable
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK-LABEL: @test_closure_propagation : $@thin () -> () {
|
||||||
|
// CHECK-NOT: partial_apply
|
||||||
|
sil hidden [fragile] @test_closure_propagation : $@thin () -> () {
|
||||||
|
bb0:
|
||||||
|
%f1 = function_ref @callee : $@thin (Builtin.Word) -> ()
|
||||||
|
%i1 = integer_literal $Builtin.Word, 24
|
||||||
|
%p1 = partial_apply %f1(%i1) : $@thin (Builtin.Word) -> ()
|
||||||
|
|
||||||
|
%f2 = function_ref @thunk : $@thin (@out (), @owned @callee_owned () -> ()) -> ()
|
||||||
|
%s1 = alloc_stack $()
|
||||||
|
%a1 = apply [transparent] %f2(%s1#1, %p1) : $@thin (@out (), @owned @callee_owned () -> ()) -> ()
|
||||||
|
dealloc_stack %s1#0 : $*@local_storage ()
|
||||||
|
unreachable
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user