-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeating an enum does not generate a memset #101685
Comments
@rustbot label A-codegen |
there is also an issue which is probably related, where this doesn't get vectorized at all pub fn create_array() -> [Result<u16, u8>; 512] {
[Ok(0); 512]
} |
This regressed between |
This works fine though. #![feature(inline_const)]
pub fn create_array() -> [Result<u16, u8>; 512] {
const { [Ok(0); 512] }
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code: godbolt
I expected to see this happen: This should compile to a memset, or the equivalent unrolled SIMD stores
LLVM IR
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.
The text was updated successfully, but these errors were encountered: