Skip to content

[OpaqueValues] Handled more instructions. #61924

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

Merged

Conversation

nate-chandler
Copy link
Contributor

  • unchecked_bitwise_cast to loadable type
  • existential_metatype
  • select_enum

Based on #61897 , #61917 .

Now that it can be called on partial_apply instructions,
insertAfterFullEvaluation does not name what the function does.  One
could imagine a function which inserted after the applies of
(non-escaping) partial_applies.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review November 4, 2022 14:18
@nate-chandler nate-chandler force-pushed the opaque-values/2/20221103 branch from 912855d to 8b8e916 Compare November 4, 2022 17:22
@nate-chandler
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

LGTM
...except no need to call forceDeleteWithUsers after replaceAllUsesWith

auto *load = builder.createLoad(cvi->getLoc(), destAddr,
LoadOwnershipQualifier::Copy);
cvi->replaceAllUsesWith(load);
pass.deleter.forceDelete(cvi);
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the non-copy use case?

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

Actually, visitUncheckedBitwiseCastInst isn't fully handled yet

When casting via unchecked_bitwise_cast, if the destination type is
loadable, don't mark the value it produces rewritten--that value is not
one that AddressLowering is tracking.  Instead, replace its copy_value
uses with load [copy] uses of the address the rewritten instruction
produces.
The handling is the same as for value_metatype.
@nate-chandler nate-chandler force-pushed the opaque-values/2/20221103 branch from 8b8e916 to 57352d7 Compare November 4, 2022 17:49
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler merged commit 02ee6b6 into swiftlang:main Nov 4, 2022
@nate-chandler nate-chandler deleted the opaque-values/2/20221103 branch November 4, 2022 23:15
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