-
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
Range<usize>::next
should fully MIR-inline
#130590
Comments
I tried adding Maybe something to do with specialization since I think this ends up at rust/library/core/src/iter/range.rs Lines 750 to 760 in 506f22b
EDIT: Also tried increasing
and that wasn't enough either. |
this fixes it, but also breaks the exponential growth test, so needs something smarter... let inline_limit = match self.history.len() {
0 => usize::MAX,
- 1..=TOP_DOWN_DEPTH_LIMIT => 1,
+ 1..=TOP_DOWN_DEPTH_LIMIT => 3,
_ => return,
}; |
Inline smaller callees first Then limit the total size and number of inlined things, to allow more top-down inlining (particularly important after calling something generic that couldn't inline internally) without getting exponential blowup. Fixes rust-lang#130590 r? saethlin
If you compile this to optimized MIR:
https://rust.godbolt.org/z/zsh6b6Y8n
You'll see that it still contains a call to
forward_unchecked
:That's pretty unfortunate, because
forward_unchecked(a, 1)
is justAddUnchecked(a, 1)
, a single MIR operator.The text was updated successfully, but these errors were encountered: