-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Trivial vec![] creation then iteration doesn't optimize out the allocation #43272
Comments
Are there any ways to write automated tests to check for "regressions" like this? Assertions against LLVM bitcode? |
@nodakai Yes |
cc @arielb1 -- seems LLVM related |
Nope. Just rust/src/liballoc/allocator.rs Line 210 in 0565653
|
I didn't confirm that making Layout::repeat as inline fixes this, so please confirm that/add a test before closing. |
This fixes an optimization regression by allowing LLVM to see through more functions. Closes rust-lang#43272
…Sushi std: Mark `Layout::repeat` as `#[inline]` This fixes an optimization regression by allowing LLVM to see through more functions. Closes rust-lang#43272
This fixes an optimization regression by allowing LLVM to see through more functions. Closes rust-lang#43272
…Sushi std: Mark `Layout::repeat` as `#[inline]` This fixes an optimization regression by allowing LLVM to see through more functions. Closes rust-lang#43272
This fixes an optimization regression by allowing LLVM to see through more functions. Closes rust-lang#43272
Rustc used to be able to replace
vec![1, 2, 3].iter().sum::<i32>()
with a constant when optimizing, not at the moment. It simply looks like a Layout method that is not inlinable.(This is a regression strictly speaking — stable & beta can do this optimization, but not nightly.)
Code to reproduce:
playground link
The text was updated successfully, but these errors were encountered: