-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Never inline C variadics, cold functions, functions with incompatible attributes ... #78966
Conversation
@bors r+ very excited about the generator inlining. With this we'll be able to craft some MIR optimizations for async code |
📌 Commit f91a0ef has been approved by |
Never inline C variadics, cold functions, functions with incompatible attributes ... ... and fix generator inlining. Closes rust-lang#67863. Closes rust-lang#78859.
The inliner looks if a sanitizer is enabled before considering `no_sanitize` attribute as possible source of incompatibility. The MIR inlining could happen in a crate with sanitizer disabled, but code generation in a crate with sanitizer enabled, thus the attribute would be incorrectly ignored. To avoid the issue never inline functions with different `no_sanitize` attributes.
The information about cold attribute is lost during inlining, Avoid the issue by never inlining cold functions.
The callee body is already transformed; the condition is always false.
f91a0ef
to
2a010dd
Compare
Ignored new generator test on wasm. |
@bors r+ |
📌 Commit 2a010dd has been approved by |
Never inline C variadics, cold functions, functions with incompatible attributes ... ... and fix generator inlining. Closes rust-lang#67863. Closes rust-lang#78859.
Never inline C variadics, cold functions, functions with incompatible attributes ... ... and fix generator inlining. Closes rust-lang#67863. Closes rust-lang#78859.
Never inline C variadics, cold functions, functions with incompatible attributes ... ... and fix generator inlining. Closes rust-lang#67863. Closes rust-lang#78859.
Rollup of 15 pull requests Successful merges: - rust-lang#78352 (Do not call `unwrap` with `signatures` option enabled) - rust-lang#78590 (refactor: removing alloc::collections::vec_deque ignore-tidy-filelength) - rust-lang#78848 (Bump minimal supported LLVM version to 9) - rust-lang#78856 (Explicitly checking for or-pattern before test) - rust-lang#78948 (test: add `()=()=()=...` to weird-exprs.rs) - rust-lang#78962 (Add a test for r# identifiers) - rust-lang#78963 (Added some unit tests as requested) - rust-lang#78966 (Never inline C variadics, cold functions, functions with incompatible attributes ...) - rust-lang#78968 (Include llvm-as in llvm-tools-preview component) - rust-lang#78969 (Normalize function type during validation) - rust-lang#78980 (Fix rustc_ast_pretty print_qpath resulting in invalid macro input) - rust-lang#78986 (Avoid installing external LLVM dylibs) - rust-lang#78988 (Fix an intrinsic invocation on threaded wasm) - rust-lang#78993 (rustc_target: Fix dash vs underscore mismatches in option names) - rust-lang#79013 (Clean up outdated `use_once_payload` pretty printer comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Does this PR have the potential to break this workaround in hashbrown? rust-lang/hashbrown#209 |
@novacrazy Thanks, that is a great example of a pattern that patch here tries to enable. Currently in MIR the cold attribute can be only attached to a function. If a call to a cold function were to be inlined in MIR, the fact that this is a cold path is lost to the LLVM. The changes here disable inlining of cold functions at MIR level precisely to preserve this information. That being said, the MIR inlining is disabled by default. So unless |
Anecdotally, this happens when LLVM inlines cold functions too (which it does if you only have one call to it unless it's |
... and fix generator inlining.
Closes #67863.
Closes #78859.