-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[4.1] SIL: Fix zealous assert in verifier #14134
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
[4.1] SIL: Fix zealous assert in verifier #14134
Conversation
A materialize for set / write-back sequence is not really mutating the opened existential rdar://36799163
@swift-ci Please test |
// Non-Mutating set pattern that allows a inout (that can't really | ||
// write back. | ||
if (auto *AI = dyn_cast<ApplyInst>(inst)) { | ||
if (isa<PointerToThinFunctionInst>(AI->getCallee())) { |
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 don't get it. What does the function representation have to do with consuming-or-mutating arguments? I think this warrants a little more explanation.
The only producer of this instruction is SILGen when it generates a materialize for set. |
I will follow-up with an updated comment on the master branch. |
Build failed |
Build failed |
@swift-ci Please test |
@swift-ci Please test source compatibility |
Build failed |
Build failed |
@swift-ci Please test |
Build failed |
Build failed |
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.
Approved for CCC.
@swift-ci please nominate |
A materialize for set / write-back sequence is not really mutating the opened existential on an Rvalue existential.
rdar://36799163
Explanation: We generate a write back for a non-mutating set on an r-value. This write back looks like a mutation on an open_existenial that only allows immutable access. The verifier of open_existential instructions will look at the use and complain when this use really is safe. The patch disable verification in this case.
Scope: A fix that makes the SIL verifier not assert on a correct code pattern.
Risk: Low. This disables an invalid assertion.
Testing: A Swift CI test was added