Description
LLVM is currently incapable of analysing the alias implications of these conversions despite a set of rules being defined for them, so they're an opaque wall blocking optimizations. I fixed the offset
family of functions in the ptr
module but vectors are a bit problematic.
Vector iterators use a pointer to the start and a pointer one byte past the end, so an iteration of the loop is just an increment (or decrement, in reverse) of a pointer and a comparison between the start and end.
Since zero-size types can be stored in vectors, it currently uses nonzero_size_of
to increment the pointer instead of the optimized offset
functions - otherwise iterating of a vector of 11 zero-size types would stop immediately instead of looping 11 times. This can likely be fixed by special-casing the iterator for zero-size types.