-
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
vec![None; 1024] randomly gets vectorized or not #106911
Comments
Easiest fix for We don't guarantee a layout for it, but internally for optimizations I think we'd be safe doing this. (We can put some tests like |
When |
Unfortunately not, because there can be other niches than 0. For instance, |
Can we at least assume that two |
I think similar to #101685. iirc the main issue is that LLVM's InstCombine removes the |
No, because something like
That's exactly what I mention |
I want to initialize a large
Vec<Option<i32>>
withNone
.Compiling with Rust 1.66
-C opt-level=3 -C target-cpu=skylake
generatesmov
instructions.However, after initializing with
Some(...)
the code gets vectorized as expected:The generated assembly contains
vmovups
instructions.Now, the weird thing is that if I have both functions in the same file, both get vectorized.
See this demonstration. As long as
vec_some()
is commented out,vec_none()
is not vectorized. As soon as you remove the comment, both functions are vectorized.The text was updated successfully, but these errors were encountered: