-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
MIR unified ADTs #30890
MIR unified ADTs #30890
Conversation
f39bfd1
to
4e9c88f
Compare
} | ||
} else { | ||
ExprKind::Call { | ||
ty: &cx.tcx.node_id_to_type(fun.id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was present before, but I think this &
is redundant and will just get deref-coerced out of existence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably a remnant of when the code was generic over the HIR.
Can you add a few more tests:
Otherwise, looks good to me. |
To be clear, r=me with more tests. |
4e9c88f
to
b9d54b6
Compare
@bors r=nikomatsakis |
📌 Commit b9d54b6 has been approved by |
b9d54b6
to
949dc72
Compare
@bors r=nikomatsakis 949dc72 (had omitted a rustc_mir attribute on test) |
We might want a more generic infrastructure to handle things like intrinsics, and maybe even trivial |
⌛ Testing commit 949dc72 with merge fef6ad1... |
💔 Test failed - auto-mac-64-nopt-t |
Previously we would generate regular calls for these, which is likely to result in worse LLVM code, especially in presence of cleanups – we needn’t unecessarilly generate landing pads to construct an ADT!
bb50c48
to
72eacc1
Compare
@bors r=nikomatsakis 72eacc1 (merge conflict with another patch which was not realised by git) |
Previously it would go through def_id and retrieve a type that’s not always correct, monomorphized, etc.
These tests test building and matching some non-trivial ADT configurations such as C-like enums and packed structs.
72eacc1
to
7d6da8e
Compare
This PR changes translation of tuple-like ADTs from being calls to being proper aggregates. This change is done in hope to make code generation better. Namely, now we can avoid: 1. Call overhead; 2. Generating landingpads in presence of cleanups (we know for sure constructing ADTs can’t panic); 3. And probably much more, gaining better MIR introspectablilty. Along with that a few serious deficiencies with translation of ADTs and switches have been fixed as well (commits 2 and 3). r? @nikomatsakis cc @tsion
This PR changes translation of tuple-like ADTs from being calls to being proper aggregates. This change is done in hope to make code generation better. Namely, now we can avoid:
Along with that a few serious deficiencies with translation of ADTs and switches have been fixed as well (commits 2 and 3).
r? @nikomatsakis
cc @tsion