Skip to content
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 two bugs which cause SIL verification errors #78524

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eeckstein
Copy link
Contributor

  1. CodeMotion: check the ownership of arguments when sinking arguments

So far we only checked the ownership of incoming values.
But even if the incoming instruction has no ownership, the argument may have.
This can happen with enums which are constructed with a non-payload case:

   %1 = enum $Optional<C>, #Optional.none!enumelt
   br bb3(%1)
 bb1(%3 : @owned $Optional<C>):
  1. SimplifyCFG: correctly handle borrowed-from values when removing a redundant phi argument.

We need to make sure that the arguments to a borrowed-from instruction are not borrowed-from instructions, too, but their underlying phi arguments.

rdar://142506300

So far we only checked the ownership of incoming values.
But even if the incoming instruction has no ownership, the argument may have.
This can happen with enums which are constructed with a non-payload case:

   %1 = enum $Optional<C>, #Optional.none!enumelt
   br bb3(%1)
 bb1(%3 : @owned $Optional<C>):

Fixes an ownership verification error:
rdar://142506300
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

Copy link
Contributor

@nate-chandler nate-chandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants