-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-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
Code
I tried this code:
use std::alloc::{Layout, LayoutError};
#[inline(never)]
pub fn test_1() -> Result<Layout, LayoutError> {
Layout::from_size_align(4, 4)
}https://rust.godbolt.org/z/seM4jzcWh
I expected to see this happen:
It should compile down to
example::test_1::hbf988c64c71bb848:
mov eax, 4
mov edx, 4
retInstead, this happened:
It compiled down to (note the function call!)
example::test_1::h56b9105842f7b121:
push rax
mov edi, 4
mov esi, 4
call qword ptr [rip + core::alloc::layout::Layout::is_size_align_valid::h27157fff07002cf3@GOTPCREL]
movzx eax, al
shl eax, 2
mov edx, 4
pop rcx
retVersion it worked on
It most recently worked on: 1.81.0
Version with regression
Every version from 1.82.0 onwards has this regression
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-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.