search for: crate_type

Displaying 1 result from an estimated 1 matches for "crate_type".

2017 Dec 21
2
Pass ordering - GVN vs. loop optimizations
...because GVN appears to be the only pass that can merge loads across basic blocks. This means that if a loop index only appears behind a pointer, LLVM will not be able to optimize out bounds checks depending on it. The "canonical" example is this Rust function (or the similar C code): #![crate_type="rlib"] pub fn f(length: &usize) -> u64 { let mut sum = 0; let len_1 = *length; let mut i = 0; while i < len_1 { let len_2 = *length; assert!(i < len_2); i += 1; } sum } One would expect the assertion (which in a real example is a bounds check) to be...