-
Notifications
You must be signed in to change notification settings - Fork 12.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
Optimize tvec::iter_vec_raw #3729
Comments
So this dates from c9c5ee2 (aug 2011) when we had runtime-dynamic-sized types floating around and potentially in the inside of vectors. So the scary part of it is gone. As a minor improvement to codegen on vector glue, one might as well try to implement it properly, which just means switching from byte-adding operations on byte-pointers to GEPi on properly typed pointers. One could also reasonably argue that this should long since have been moved into library code and/or lang items. I would not object to that solution! |
I'd also nominate for removing this from the production-ready milestone. It's not important enough to block. The codegen is so much worse elsewhere, this isn't a high priority. |
just-a-performance-bug, removing milestone. |
visiting for triage, email from 2013 sep 16. I'm not an expert in the trans code (this is code from middle::trans::tvec). Its not obvious to me what is blocking this bug, if anything. But fixing it locally within |
Visiting for triage Work is still needed: |
There are two places left where we used to only know the byte size of/offset into an array and had to cast to i8 and back to get the right addresses. But by now, we always know the sizes in terms of the number of elements in the array. In fact we have to add an extra Mul instruction so we can use the weird cast-to-u8 code. So we should really just embrace our new knowledge and use simple GEPs to do the address calculations. Additionally, the pointer calculations in bind_subslice_pat don't handle zero-sized types correctly, producing slices that point outside the array that is being matched against. Using GEP fixes that as well. Fixes rust-lang#3729
There are two places left where we used to only know the byte size of/offset into an array and had to cast to i8 and back to get the right addresses. But by now, we always know the sizes in terms of the number of elements in the array. In fact we have to add an extra Mul instruction so we can use the weird cast-to-u8 code. So we should really just embrace our new knowledge and use simple GEPs to do the address calculations. Fixes rust-lang#3729
FIXME in tvec::iter_vec_raw says:
FIXME (#2536): Optimize this when the size of the unit type is // statically known to not use pointer casts, which tend to confuse // LLVM.
#2536 is now closed, so filing this separately.
The text was updated successfully, but these errors were encountered: