summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
blob: b2ea96f033ef03468df09085bd6442e6ac9195ae (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// MIR for `step_forward` after PreCodegen

fn step_forward(_1: u32, _2: usize) -> u32 {
    debug x => _1;
    debug n => _2;
    let mut _0: u32;
    scope 1 (inlined <u32 as Step>::forward) {
        debug start => _1;
        debug n => _2;
        let _3: std::option::Option<u32>;
        let mut _6: bool;
        let mut _7: u32;
        let mut _8: &std::option::Option<u32>;
        scope 2 {
        }
        scope 3 (inlined Option::<u32>::is_none) {
            debug self => _8;
            let mut _5: bool;
            scope 4 (inlined Option::<u32>::is_some) {
                debug self => _8;
                let mut _4: isize;
            }
        }
        scope 5 (inlined core::num::<impl u32>::wrapping_add) {
            debug self => _1;
            debug rhs => _7;
        }
    }

    bb0: {
        StorageLive(_6);
        StorageLive(_8);
        StorageLive(_3);
        _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
    }

    bb1: {
        StorageLive(_5);
        _4 = discriminant(_3);
        _5 = Eq(_4, const 1_isize);
        _6 = Not(move _5);
        StorageDead(_5);
        StorageDead(_3);
        StorageDead(_8);
        switchInt(move _6) -> [0: bb3, otherwise: bb2];
    }

    bb2: {
        assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb3, unwind continue];
    }

    bb3: {
        StorageDead(_6);
        StorageLive(_7);
        _7 = _2 as u32 (IntToInt);
        _0 = Add(_1, _7);
        StorageDead(_7);
        return;
    }
}