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

llvm: lower tagged union payload as byte array #21354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mlugg
Copy link
Member

@mlugg mlugg commented Sep 9, 2024

At this point, I feel more comfortable with this lowering than I do further complicating this type lowering logic. I do wonder whether we ought to start lowering other types as byte arrays, and using byte-level GEPs -- it would make lowering less error-prone, and I highly doubt would actually hinder LLVM's ability to optimize.

Resolves: #21343

@mlugg mlugg enabled auto-merge (rebase) September 9, 2024 02:51
@Jarred-Sumner
Copy link
Contributor

will this impact seeing union tags and payloads in a debugger?
image

@mlugg
Copy link
Member Author

mlugg commented Sep 10, 2024

No, this is not related to debug info.

At this point, I feel more comfortable with this lowering than I do
further complicating this type lowering logic. I do wonder whether we
ought to start lowering other types as byte arrays, and using byte-level
GOPs -- it would make lowering less error-prone, and I highly doubt
would actually hinder LLVM's ability to optimize.

We now always lower (non-packed) union values using the ptrcast path,
since the payload is always represented using a byte array.

Resolves: ziglang#21343
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.

runtime @unionInit of underaligned union type corrupts stack
2 participants