-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.1][cast-opt] Fix miscompile when we tried to optimize take_on_success that resulted in invalid IR being emitted. #25074
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
[5.1][cast-opt] Fix miscompile when we tried to optimize take_on_success that resulted in invalid IR being emitted. #25074
Conversation
@swift-ci test |
Build failed |
Build failed |
Importantly this lets us know further on in the function that as an invariant we only can have checked_cast_addr_br. (cherry picked from commit 13a3dbb)
…hat resulted in invalid IR being emitted. The specific problem here is that we are setting the insertion point of a SILBuilder and not unsetting it. I fixed the problem by creating a separate builder so the original builder stays put. I originally came across this in my work on moving ownership stripping after the diagnostic passes. This patch fixes it without my other changes to ease cherry-picking to 5.1. I also added more test coverage by expanding the test case to also handle copy_on_success and take_always. rdar://51093557 (cherry picked from commit ad67685)
e7b36da
to
16e4d80
Compare
@swift-ci test |
Build failed |
Build failed |
I had to adjust a test for some differences from master -> 5.1. I put it in a separate commit on top. |
@swift-ci test |
Build failed |
Build failed |
@atrick this is the same one from master modulo small test changes to reflect cleanups that I did not do on 5.1 but did do on master. |
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.
lgtm
[cast-opt] Fix miscompile when we tried to optimize take_on_success that resulted in invalid IR being emitted.
The specific problem here is that we are setting the insertion point of a
SILBuilder and not unsetting it. I fixed the problem by creating a separate
builder so the original builder stays put.
I originally came across this in my work on moving ownership stripping after the
diagnostic passes. This patch fixes it without my other changes to ease
cherry-picking to 5.1.
I also added more test coverage by expanding the test case to also handle
copy_on_success and take_always.
rdar://51093557
(cherry picked from commit ad67685)
NOTE: I also cherry-picked a small cleanup from master as well that eliminated a merge conflict on this code path. That is the first commit.