-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed as not planned
Closed as not planned
Copy link
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.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
pub fn copy_u32(input: &[u8; 4], output: &mut [u8; 4]) {
let a = &input[..4];
let b = &mut output[..4];
for b in b.chunks_exact_mut(4) {
b.copy_from_slice(a);
}
}
Complied with -C opt-level=s -C inline-threshold=300
produces (same as just -C opt-level=s
)
example::copy_u32:
mov rax, rsi
mov rdx, rdi
mov esi, 4
mov ecx, 4
mov rdi, rax
jmp qword ptr [rip + core::slice::<impl [T]>::copy_from_slice@GOTPCREL]
Complied with -C opt-level=s -C llvm-args=-inline-threshold=300
produces
example::copy_u32:
mov eax, dword ptr [rdi]
mov dword ptr [rsi], eax
ret
Fixing this seems to either require converting the rustc-received argument to LLVM commandline one, or constructing a custom llvm::InlineParams
structure instead of using one of LLVM-provided helper functions?
Corallus-Caninus and hudson-ayers
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.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.