Emit noundef on small aggregate returns in the x86 Win32 ABI - #160368
Open
Vastargazing wants to merge 1 commit into
Open
Emit noundef on small aggregate returns in the x86 Win32 ABI#160368Vastargazing wants to merge 1 commit into
Vastargazing wants to merge 1 commit into
Conversation
The x86 Win32 (MSVC) ABI returns small aggregates in an integer register via `cast_to`, which drops the argument attributes -- so these returns never carried `noundef`, unlike scalars, which get it from `arg_attrs_for_rust_scalar`. Switch those casts to `cast_to_maybe_noundef` so a return whose layout is provably free of uninit bytes gets `noundef`, while padded layouts correctly omit it.
Collaborator
|
|
Member
|
I'm not sure what is special about win32 that we would only do this there. Anyway evaluating actual ABI adjustments is outside what I can do. |
Collaborator
|
|
Contributor
Author
|
Yep, win32 was just an easy first target for the cast_to_maybe_noundef helper, nothing special about it. No strong preference on the rest: small per-arch PRs, or fold them into this one, whatever's easiest to review. No rush, happy to follow your lead 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #160313
Now that
ArgAbi::cast_to_maybe_noundefis in place, this PR switches the x86 Win32 (MSVC) small-aggregate return casts over to it.With this change, returns whose layout is provably free of uninit bytes keep
noundef, while padded layouts correctly omit it.As discussed on Zulip, this is the foreign-ABI follow-up split out from the original PR.
Added
tests/codegen-llvm/abi-noundef-cast-win32.rscovering both positive (unpadded struct ->noundef) and negative (padded struct -> nonoundef) cases oni686-pc-windows-msvc.r? @RalfJung