-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Fix convert_escape_to_noescape non-dominance errors #15610
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
Fix convert_escape_to_noescape non-dominance errors #15610
Conversation
@swift-ci Please test |
@swift-ci Please test source compatibility |
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.
I don't see any change in functionality. Just default arguments. And I don't see any new CHECK lines in the test (only saw the first commit first time around).
lib/SILGen/SILGenBuilder.cpp
Outdated
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.
80-col (git format)
lib/SILGen/SILGenExpr.cpp
Outdated
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.
Ignore my previous comment. I'm not sure why this didn't show up in my first review. It's not clear why you want to use a double negative everywhere instead of just postponeNoEscapeCleanup = true
.
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.
Ok, but why are you doing this transformation? Please explain in the comment why the SIL input to DI is invalid.
What happens when the SIL deviates from this elaborate pattern and DI bails out? How is this elaborate pattern tied to the SILGen functionality that you added? Can we just add an instruction, like mark_uninitialized, that communicates the situation to DI rather than assuming we can precisely recognize SILGen's output in all situations. I assume this was arrived at after eliminating reasonable approaches:
|
This is a plaster until I have time to remove PostponedCleanup in favor of a full implementation (the mark_initalized way your are eluding to) of handling the postponement in DI. I want to get rid of postponement in SILGen. |
Instead of DI, can the long term fix introduce a new SIL pass? This is not really related to DI. |
Sure. |
@swift-ci Please test linux |
Build failed |
@swift-ci Please smoke test os x |
…ide an bind optional This would violate dominance since the convertEscapeToNoEscape instruction does not dominate the postpone point. rdar://38124009
…_noescape [not_guaranteed] operand Either through a peephole or we keep the closure operand alive to the end of the function rdar://38124009
597c8e9
to
f40ac5d
Compare
@swift-ci Please test |
@swift-ci Please test source compatibility |
Build failed |
Build failed |
The new patchset adds patches that make sure we ensure the lifetime of the escaping closure: either through the peephole or by keeping the closure alive to the end of the function if the peephole fails. |
There should be documentation other than in my head that 'convert_escape_to_noescape [not_guaranteed]' means that a pass must be run after SILGen that ensures the lifetime of the escaping closure extends beyond the last use of the trivial closure result. |
lib/Serialization/SerializeSIL.cpp
Outdated
/// Write an instruction that looks exactly like a conversion: all | ||
/// important information is encoded in the operand and the result type. | ||
void SILSerializer::writeConversionLikeInstruction(const SingleValueInstruction *I) { | ||
__attribute__((noinline)) |
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 is going away in a follow-up.
Latest source compatibility run: https://ci.swift.org/view/Pull%20Request/job/swift-PR-source-compat-suite/970/ |
@swift-ci Please smoke test |
No description provided.