eeeb2cc0df
Using regular pointer arithmetic to iterate collections of zero-sized types doesn't work, because we'd get the same pointer all the time. Our current solution is to convert the pointer to an integer, add an offset and then convert back, but this inhibits certain optimizations. What we should do instead is to convert the pointer to one that points to an i8*, and then use a LLVM GEP instructions without the inbounds flag to perform the pointer arithmetic. This allows to generate pointers that point outside allocated objects without causing UB (as long as you don't dereference them), and it wraps around using two's complement, i.e. it behaves exactly like the wrapping_* operations we're currently using, with the added benefit of LLVM being able to better optimize the resulting IR. |
||
---|---|---|
.. | ||
debuginfo | ||
_match.rs | ||
adt.rs | ||
asm.rs | ||
attributes.rs | ||
base.rs | ||
basic_block.rs | ||
build.rs | ||
builder.rs | ||
cabi_aarch64.rs | ||
cabi_arm.rs | ||
cabi_mips.rs | ||
cabi_powerpc.rs | ||
cabi_x86_64.rs | ||
cabi_x86_win64.rs | ||
cabi_x86.rs | ||
cabi.rs | ||
callee.rs | ||
cleanup.rs | ||
closure.rs | ||
common.rs | ||
consts.rs | ||
context.rs | ||
controlflow.rs | ||
datum.rs | ||
declare.rs | ||
expr.rs | ||
foreign.rs | ||
glue.rs | ||
inline.rs | ||
intrinsic.rs | ||
llrepr.rs | ||
machine.rs | ||
macros.rs | ||
meth.rs | ||
mod.rs | ||
monomorphize.rs | ||
tvec.rs | ||
type_.rs | ||
type_of.rs | ||
value.rs |