-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Consider the following minimized example:
pub fn test() {
for _ in 0..128 {
let _ = vec![0; 32];
}
}
Expected generated output (Rust 1.81.0):
example::test::h15f9c44deb8efbb9:
ret
Actual output (Rust Nightly):
example::test::h15f9c44deb8efbb9:
mov rax, qword ptr [rip + __rust_no_alloc_shim_is_unstable@GOTPCREL]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx ecx, byte ptr [rax]
movzx eax, byte ptr [rax]
ret
Godbolt: https://www.godbolt.org/z/x458Pv8P5
findepi, milevin and vgapeyev
Metadata
Metadata
Assignees
Labels
A-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.