Open
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.