summary refs log tree commit diff
path: root/src/test/mir-opt/const_prop/switch_int.rs
blob: 904d303d87e313527e26e777b9c1cda4e541e700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[inline(never)]
fn foo(_: i32) { }

fn main() {
    match 1 {
        1 => foo(0),
        _ => foo(-1),
    }
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
//  bb0: {
//      ...
//      _1 = const 1i32;
//      switchInt(_1) -> [1i32: bb2, otherwise: bb1];
//  }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
//  bb0: {
//      ...
//      switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1];
//  }
// END rustc.main.ConstProp.after.mir
// START rustc.main.SimplifyBranches-after-const-prop.before.mir
//  bb0: {
//      ...
//      _1 = const 1i32;
//      switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1];
//  }
// END rustc.main.SimplifyBranches-after-const-prop.before.mir
// START rustc.main.SimplifyBranches-after-const-prop.after.mir
//  bb0: {
//      ...
//      _1 = const 1i32;
//      goto -> bb2;
//  }
// END rustc.main.SimplifyBranches-after-const-prop.after.mir