summary refs log tree commit diff
path: root/src/test/mir-opt/combine_array_len.rs
blob: 9a046202cd004135fb0cdf5474e3a65e0ae36fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn norm2(x: [f32; 2]) -> f32 {
    let a = x[0];
    let b = x[1];
    a*a + b*b
}

fn main() {
    assert_eq!(norm2([3.0, 4.0]), 5.0*5.0);
}

// END RUST SOURCE

// START rustc.norm2.InstCombine.before.mir
//     _4 = Len(_1);
//     ...
//     _8 = Len(_1);
// END rustc.norm2.InstCombine.before.mir

// START rustc.norm2.InstCombine.after.mir
//     _4 = const 2usize;
//     ...
//     _8 = const 2usize;
// END rustc.norm2.InstCombine.after.mir