Skip to content

[IRGen] Cast fixed-size opaque globals. #68000

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

In #66560 , a bug in the lowering of global_addr was fixed. Part of that fix was to postpone mapping the type of the global into context until getting the address of the global and projecting the buffer for the out-of-line value; at that point, the type is mapped into context and the address is cast.

It introduced an issue for fixed-size globals, however: the type of such globals was not mapped into context; the result was that the lowered value set for the corresponding SIL value would have the wrong type.

Fix that by extracting the code which mapped the type into context and cast the address to the appropriate lowered type into a lambda and call that lambda both in both the fixed-size (newly) and non-fixed-size (as before) cases.

rdar://114013709

In swiftlang#66560 , a bug in the lowering of
`global_addr` was fixed.  Part of that fix was to postpone mapping the
type of the global into context until getting the address of the global
and projecting the buffer for the out-of-line value; at that point, the
type is mapped into context and the address is cast.

It introduced an issue for fixed-size globals, however: the type of such
globals was not mapped into context; the result was that the lowered
value set for the corresponding SIL value would have the wrong type.

Fix that by extracting the code which mapped the type into context and
cast the address to the appropriate lowered type into a lambda and call
that lambda both in both the fixed-size (newly) and non-fixed-size (as
before) cases.

rdar://114013709
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@nate-chandler nate-chandler merged commit c0fa16e into swiftlang:main Aug 18, 2023
@nate-chandler nate-chandler deleted the cherrypick/main/rdar114013709 branch August 18, 2023 13:59
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