Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTrivial vec![] creation then iteration doesn't optimize out the allocation #43272
Comments
bluss
added
I-slow
regression-from-stable-to-nightly
labels
Jul 16, 2017
This comment has been minimized.
This comment has been minimized.
|
Are there any ways to write automated tests to check for "regressions" like this? Assertions against LLVM bitcode? |
This comment has been minimized.
This comment has been minimized.
|
@nodakai Yes |
alexcrichton
added
regression-from-stable-to-beta
and removed
regression-from-stable-to-nightly
labels
Jul 23, 2017
Mark-Simulacrum
added
C-enhancement
P-medium
T-compiler
labels
Jul 26, 2017
This comment has been minimized.
This comment has been minimized.
|
cc @arielb1 -- seems LLVM related |
This comment has been minimized.
This comment has been minimized.
|
Nope. Just rust/src/liballoc/allocator.rs Line 210 in 0565653 |
This comment has been minimized.
This comment has been minimized.
arielb1
added
T-libs
and removed
T-compiler
labels
Jul 27, 2017
This comment has been minimized.
This comment has been minimized.
|
I didn't confirm that making Layout::repeat as inline fixes this, so please confirm that/add a test before closing. |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 27, 2017
alexcrichton
referenced this issue
Jul 27, 2017
Merged
std: Mark `Layout::repeat` as `#[inline]` #43513
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 27, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 27, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Jul 29, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 29, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 29, 2017
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Jul 30, 2017
bors
closed this
in
#43513
Jul 30, 2017
matthewhammer
pushed a commit
to matthewhammer/rust
that referenced
this issue
Aug 3, 2017
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Aug 12, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bluss commentedJul 16, 2017
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