search for: len_2

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

Did you mean: len2
2017 Dec 21
2
Pass ordering - GVN vs. loop optimizations
...e 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 optimized out. However, IndVarSimplify is the optimization that is supposed to do that, and it only runs *before* GVN, so it "sees" 2 separate lo...