-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
For this code https://is.gd/JbfHAI
#![crate_type = "lib"]
pub extern fn clone(bits: &mut Box<[u64; 1024]>) -> Box<[u64; 1024]> {
Box::new(**bits)
}
It copies data to the stack first, before allocating and copying again to the heap.
.cfi_offset rbx, -16
mov rsi, qword ptr [rdi]
lea rdi, [rsp]
mov edx, 8192
call memcpy@PLT
mov edi, 8192
mov esi, 8
call __rust_allocate@PLT
mov rbx, rax
test rbx, rbx
je .LBB0_2
lea rsi, [rsp]
mov edx, 8192
mov rdi, rbx
call memcpy@PLT
mov rax, rbx
add rsp, 8192
pop rbx
ret
MOZGIII, ixcviw7bw, andrewbanchich, yuyoyuppe, q2p and 5 more
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.