- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Milestone
Description
For this code:
pub struct A([i32; 4]);
impl A {
    pub fn foo(self) -> Self { self }
    pub fn bar(self) -> Self { self }
}rustc beta (1.28.0) with opt-level=3 generates:
example::A::bar:
        movups  xmm0, xmmword ptr [rsi]
        movups  xmmword ptr [rdi], xmm0
        mov     rax, rdi
        ret
example::A::foo:
        push    rbx
        mov     rbx, rdi
        call    example::A::bar@PLT
        mov     rax, rbx
        pop     rbx
        retrustc 1.27.1 and rustc beta with opt-level=s generates:
example::A::foo:
        movups  xmm0, xmmword ptr [rsi]
        movups  xmmword ptr [rdi], xmm0
        mov     rax, rdi
        ret
example::A::bar:
        movups  xmm0, xmmword ptr [rsi]
        movups  xmmword ptr [rdi], xmm0
        mov     rax, rdi
        retThe beta with opt-level=3 seems to be anti-inlining the identical functions.
LifeIsStrange
Metadata
Metadata
Assignees
Labels
I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.