-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code: godbolt
pub fn create_array() -> [Option<u8>; 256] {
[None; 256]
}
I expected to see this happen: This should compile to a memset, or the equivalent unrolled SIMD stores
Instead, this happened: It compiles to a bunch of movs.
I think this happens because we transform this to a bunch of stores of the discriminant, without touching the data part of the option, making it impossible for LLVM to memset this. Ideally, we'd write 0 to the data part as well here, allowing this to use memset.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.