-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Open
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.A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchP-highHigh priorityHigh priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
The code is slightly minimized from this forum thread.
use std::mem::MaybeUninit;
#[derive(Debug)]
pub struct Stack<T, const CAP: usize> {
len: usize,
v: MaybeUninit<[T; CAP]>,
}
impl<T, const CAP: usize> Stack<T, CAP> {
/// Create a new empty `Stack`.
pub fn new() -> Self {
Stack {
len: 0,
v: MaybeUninit::uninit(),
}
}
}
type MyStack = Stack<i32,1000>;
pub struct C {
a: MyStack,
b: MyStack,
}
impl C {
#[inline(never)]
pub fn new() -> C
{
C { a:MyStack::new(), b:MyStack::new() }
}
}This produces a large memset since 1.93
example::C::new::h966d6519f96c8d05:
push rbx
mov rbx, rdi
mov edx, 8016
xor esi, esi
call qword ptr [rip + memset@GOTPCREL]
mov rax, rbx
pop rbx
retpreviously (1.92) the asm was much more reasonable:
example::C::new::hb6aa5d89c35231d2:
mov rax, rdi
mov qword ptr [rdi + 4000], 0
mov qword ptr [rdi + 8008], 0
ret(same comparison on Compiler Explorer)
Bisection points to:
Reactions are currently unavailable
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.A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchP-highHigh priorityHigh priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-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.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.