-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Avoid triggering a pathological case in the LLVM inliner #28354
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
Conversation
When the inliner has to decided if it wants to inline a function A into an internal function B, it first checks whether it would be more profitable to inline B into its callees instead. This means that it has to analyze B, which involves checking the assumption cache. Building the assumption cache requires scanning the whole function, and because inlining currently clears the assumption cache, this scan happens again and again, getting even slower as the function grows from inlining. As inlining the huge find functions isn't really useful anyway, we can mark them as noinline, which skips the cost analysis and reduces compile times by as much as 70%. cc rust-lang#28273
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 9104a90 has been approved by |
When the inliner has to decided if it wants to inline a function A into an internal function B, it first checks whether it would be more profitable to inline B into its callees instead. This means that it has to analyze B, which involves checking the assumption cache. Building the assumption cache requires scanning the whole function, and because inlining currently clears the assumption cache, this scan happens again and again, getting even slower as the function grows from inlining. As inlining the huge find functions isn't really useful anyway, we can mark them as noinline, which skips the cost analysis and reduces compile times by as much as 70%. cc #28273
In the future, could you also add a comment indicating why these are |
The files are automatically generated, so this change will be lost next time they are updated. The correct place to perform the change seems to be https://github.com/dotdash/rust/blob/9104a902c052c1ad7fd5c1245cb1e03f88aa2f70/src/etc/platform-intrinsics/generator.py#L740 |
In addition to the |
When the inliner has to decided if it wants to inline a function A into an
internal function B, it first checks whether it would be more profitable
to inline B into its callees instead. This means that it has to analyze
B, which involves checking the assumption cache. Building the assumption
cache requires scanning the whole function, and because inlining
currently clears the assumption cache, this scan happens again and
again, getting even slower as the function grows from inlining.
As inlining the huge find functions isn't really useful anyway, we can
mark them as noinline, which skips the cost analysis and reduces compile
times by as much as 70%.
cc #28273