-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[SILGen] Fix a crash when a closure is converted to a block returning a value indirectly #73520
Conversation
a value indirectly Fix the type of the function argument added to the entry basic block. rdar://127745392
@swift-ci please test |
@swift-ci please test macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable, however, I'm not an expert in this logic
There's a bug (assertion failure) in IRGen, which I found just now. |
@swift-ci please test |
@swift-ci please test |
@@ -392,7 +392,8 @@ static void buildFuncToBlockInvokeBody(SILGenFunction &SGF, | |||
if (blockTy->getNumResults() != 0) { | |||
auto result = blockTy->getSingleResult(); | |||
if (result.getConvention() == ResultConvention::Indirect) { | |||
indirectResult = entry->createFunctionArgument(blockResultTy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem to make any difference, but I wonder whether blockConv.getSingleSILResultType(SGF.getTypeExpansionContext()))
should be passed instead of blockResultTy.getAddressType()
to createFunctionArgument
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you've got is right.
@@ -392,7 +392,8 @@ static void buildFuncToBlockInvokeBody(SILGenFunction &SGF, | |||
if (blockTy->getNumResults() != 0) { | |||
auto result = blockTy->getSingleResult(); | |||
if (result.getConvention() == ResultConvention::Indirect) { | |||
indirectResult = entry->createFunctionArgument(blockResultTy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you've got is right.
Fix the type of the function argument added to the entry basic block.
rdar://127745392