-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
-C linker-plugin-lto
prevents vectorization of mem::swap
at -C opt-level=3
#124234
Comments
-C linker-plugin-lto
prevents vectorization of ptr::swap_nonoverlapping
at -C opt-level=3
-C linker-plugin-lto
prevents vectorization of mem::swap
at -C opt-level=3
|
We used to basically be forcing this, but stopped doing that in #123185 I know nothing about what But yeah, in assembly it swaps via |
I'm not sure whether |
My workflow is getting the It's unfortunate that this does not return the fully optimized assembly, but it also makes sense since linking doesn't actually happen. I thought this issue initially was a regression because couldn't find any info on this. I confirmed that it gets vectorized in the final assembly with |
Glad to hear it's working! (and that I didn't break everything *phew*) TBH, this has been confusing me too as I work on stuff. Thus tests like https://github.com/rust-lang/rust/blob/master/tests/assembly/x86_64-typed-swap.rs as it seems that looking in LLVM IR keeps not telling the full story :( |
FWIW I just released |
I tried this code (godbolt):
I expected to see this happen: code optimizes to a few
<_ x i64>
(target-cpu-dependent) loads and stores on-C opt-level=3
.Instead, this happened: the code is not vectorized when
-C linker-plugin-lto
is also passed to the compiler (this is passed together with-Clto=...
but that has no effect here)Note that this only happens with
mem::swap
/ptr::swap_nonoverlapping
, notptr::swap
.Meta
rustc --version --verbose
:This happens since at least 1.61, but I could not find a way to bisect this, so I opted not to mark this a regression.
@rustbot modify labels: +A-LLVM +A-LTO +I-slow
The text was updated successfully, but these errors were encountered: