summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/boolean_identities.rs
blob: 2aa038034d8d71066bae7f9b2e48448b474c5de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// unit-test: ConstProp

// EMIT_MIR boolean_identities.test.ConstProp.diff
pub fn test(x: bool, y: bool) -> bool {
    // CHECK-LABEL: fn test(
    // CHECK: debug a => [[a:_.*]];
    // CHECK: debug b => [[b:_.*]];
    // CHECK: [[a]] = const true;
    // CHECK: [[b]] = const false;
    // CHECK: _0 = const false;
    let a = (y | true);
    let b = (x & false);
    a & b
}

fn main() {
    test(true, false);
}