about summary refs log tree commit diff
path: root/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir
blob: b921b96966b298abe12926f9f3837e171821d5c0 (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
61
62
63
64
65
66
67
68
69
70
// MIR for `map_via_question_mark` after PreCodegen

fn map_via_question_mark(_1: Option<i32>) -> Option<i32> {
    debug x => _1;
    let mut _0: std::option::Option<i32>;
    let mut _4: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, i32>;
    let _5: i32;
    let mut _6: i32;
    scope 1 {
        debug residual => const Option::<Infallible>::None;
        scope 2 {
            scope 7 (inlined <Option<i32> as FromResidual<Option<Infallible>>>::from_residual) {
            }
        }
    }
    scope 3 {
        debug val => _5;
        scope 4 {
        }
    }
    scope 5 (inlined <Option<i32> as Try>::branch) {
        let mut _2: isize;
        let _3: i32;
        scope 6 {
        }
    }

    bb0: {
        StorageLive(_6);
        StorageLive(_4);
        StorageLive(_2);
        StorageLive(_3);
        _2 = discriminant(_1);
        switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
    }

    bb1: {
        StorageDead(_3);
        StorageDead(_2);
        _0 = const Option::<i32>::None;
        StorageDead(_6);
        StorageDead(_4);
        goto -> bb3;
    }

    bb2: {
        _3 = copy ((_1 as Some).0: i32);
        _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3);
        StorageDead(_3);
        StorageDead(_2);
        _5 = copy ((_4 as Continue).0: i32);
        _6 = Add(copy _5, const 1_i32);
        _0 = Option::<i32>::Some(move _6);
        StorageDead(_6);
        StorageDead(_4);
        goto -> bb3;
    }

    bb3: {
        return;
    }

    bb4: {
        unreachable;
    }
}

ALLOC0 (size: 8, align: 4) {
    00 00 00 00 __ __ __ __                         │ ....░░░░
}