summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
blob: 3b49cb711b773c50e079aeabbf654e810cdc3636 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// MIR for `filter_mapped` after PreCodegen

fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () {
    debug iter => _1;
    debug f => _2;
    let mut _0: ();
    let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
    let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
    let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
    let mut _6: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
    let mut _9: std::option::Option<U>;
    let mut _10: isize;
    let _12: ();
    scope 1 {
        debug iter => _5;
        let _11: U;
        scope 2 {
            debug x => _11;
        }
        scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) {
            debug self => _6;
            let mut _7: &mut impl Iterator<Item = T>;
            let mut _8: &mut impl Fn(T) -> Option<U>;
        }
    }
    scope 3 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as IntoIterator>::into_iter) {
        debug self => _3;
    }

    bb0: {
        StorageLive(_4);
        StorageLive(_3);
        _3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> [return: bb1, unwind continue];
    }

    bb1: {
        _4 = move _3;
        StorageDead(_3);
        StorageLive(_5);
        _5 = move _4;
        goto -> bb2;
    }

    bb2: {
        StorageLive(_9);
        _6 = &mut _5;
        StorageLive(_7);
        _7 = &mut ((*_6).0: impl Iterator<Item = T>);
        StorageLive(_8);
        _8 = &mut ((*_6).1: impl Fn(T) -> Option<U>);
        _9 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _7, move _8) -> [return: bb3, unwind: bb9];
    }

    bb3: {
        StorageDead(_8);
        StorageDead(_7);
        _10 = discriminant(_9);
        switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8];
    }

    bb4: {
        StorageDead(_9);
        drop(_5) -> [return: bb5, unwind continue];
    }

    bb5: {
        StorageDead(_5);
        StorageDead(_4);
        return;
    }

    bb6: {
        _11 = move ((_9 as Some).0: U);
        _12 = opaque::<U>(move _11) -> [return: bb7, unwind: bb9];
    }

    bb7: {
        StorageDead(_9);
        goto -> bb2;
    }

    bb8: {
        unreachable;
    }

    bb9 (cleanup): {
        drop(_5) -> [return: bb10, unwind terminate];
    }

    bb10 (cleanup): {
        resume;
    }
}