-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[NoncopyableWrapperElim] Process undef values. #74298
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
Conversation
a086934
to
5147cd4
Compare
5147cd4
to
66ec214
Compare
include/swift/SIL/SILFunction.h
Outdated
return {undefValues.begin(), undefValues.end()}; | ||
} | ||
|
||
void updateTypeForUndef(SILUndef *undef, SILType oldType) { |
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's strange for an API called "updateType" to be passed the old value for the type. It makes more sense to pass the old and new undef values instead and call it "replaceUndef", or pass the old and new types and call it "replaceUndefType"
I can't make a suggestion beyond that because I don't understand where and how the undef's type actually changes.
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.
or pass the old and new types and call it "replaceUndefType"
Fixed.
where and how the undef's type actually changes
The same way as every other value this pass modifies: unsafelyEliminateMoveOnlyWrapper
.
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.
The same way as every other value this pass modifies: unsafelyEliminateMoveOnlyWrapper.
Ok, looking at this one commit at a time, it wasn't clear that recordValue(pair.second)
actually updates types. It sounds like it's actually recording the value for later update.
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.
Changed the name to visitValue
and added a short comment. Also, used RAUW
for undefs because there might already be an undef of the unwrapped type in the function's undef map.
66ec214
to
b0f2ab4
Compare
removing...To -> removing...From
This predicate is used in several places.
Replaced copy-pasted code with a twice-invoked closure. In preparation to add a third invocation.
The modified arguments were recorded but never used.
Such values' types may also also be move-only wrapped.
b0f2ab4
to
5d63fcf
Compare
@swift-ci please test |
@swift-ci please test source compatibility |
@swift-ci please apple silicon benchmark |
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.
Phew good catch. LGTM
Factored out common code path that records instructions that use values of noncopyable wrapped type and called it for the undef values in a function. Fixes a SIL verification error.
rdar://129593468