This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Basic &mut
noalias optimization in unsafe code
#24
Labels
&mut
noalias optimization in unsafe code
#24
One optimization we want for sure:
As long as
<typeof(value) as Clone>::clone
is known not to panic, this:Must be optimizable to this:
This optimization is important because the latter loop can be further optimized to a
memcpy
whenvalue
isCopy
. However, this optimization requires that the memory referenced to byptr
not alias withself.len
.We used to do that optimization in older versions of rustc (using an LLVM
noalias
attribute, not in trans), but stopped emitting that attribute because LLVM's semantics miss the "is known not to panic" requirement. If we deal with that issue, we would like to applynoalias
again.The text was updated successfully, but these errors were encountered: