-
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
Avoid using load/stores on first class aggregates #38906
Conversation
LLVM usually prefers using memcpys over direct loads/store of first class aggregates. The check in type_is_immediate to mark certain small structs was originally part of the code to handle such immediates in function arguments, and it had a counterpart in load_ty/store_ty to actually convert small aggregates to integers. But since then, the ABI handling has been refactored and takes care of converting small aggregates to integers. During that refactoring, the code to handle small aggregates in load_ty/store_ty has been removed, and so we accidentally started using loads/stores on FCA values. Since type_is_immediate() is no longer responsible for ABI-related conversions, and using a memcpy even for small aggregates is usually better than performing a FCA load/store, we can remove that code part and only handle simple types as immediates there.
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Is there a measurable effect? |
I'd like to combine this with #38854 somehow, but otherwise LGTM. |
@arielb1 Compile times seem unaffected (checked a few crates from rust itself), and for libsyntax, unoptimized BC is a bit larger (1%), while optimized BC is a tiny bit smaller, but at the same time more code was inlined, so it seems like a win overall. |
Travis failures seem legit. |
I think tests passed on my local branch which included this, will update my PR (#38854) as soon as I have a chance. |
Closing in favor of #38854 which includes my commit |
LLVM usually prefers using memcpys over direct loads/store of first class aggregates. The check in type_is_immediate to mark certain small structs was originally part of the code to handle such immediates in function arguments, and it had a counterpart in load_ty/store_ty to actually convert small aggregates to integers. But since then, the ABI handling has been refactored and takes care of converting small aggregates to integers. During that refactoring, the code to handle small aggregates in load_ty/store_ty has been removed, and so we accidentally started using loads/stores on FCA values. Since type_is_immediate() is no longer responsible for ABI-related conversions, and using a memcpy even for small aggregates is usually better than performing a FCA load/store, we can remove that code part and only handle simple types as immediates there. This integrates PR rust-lang#38906 onto this branch. Fixes rust-lang#38906.
LLVM usually prefers using memcpys over direct loads/store of first
class aggregates. The check in type_is_immediate to mark certain small
structs was originally part of the code to handle such immediates in
function arguments, and it had a counterpart in load_ty/store_ty to
actually convert small aggregates to integers.
But since then, the ABI handling has been refactored and takes care of
converting small aggregates to integers. During that refactoring, the
code to handle small aggregates in load_ty/store_ty has been removed,
and so we accidentally started using loads/stores on FCA values.
Since type_is_immediate() is no longer responsible for ABI-related
conversions, and using a memcpy even for small aggregates is usually
better than performing a FCA load/store, we can remove that code part
and only handle simple types as immediates there.