fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1- // MIR for `repeated_index` before GVN 2+ // MIR for `repeated_index` after GVN 3 4 fn repeated_index(_1: T, _2: usize) -> () { 5 debug x => _1; 6 debug idx => _2; 7 let mut _0: (); 8 let _3: [T; N]; 9 let mut _4: T; 10 let _5: (); 11 let mut _6: T; 12 let _7: usize; 13 let mut _8: usize; 14 let mut _9: bool; 15 let _10: (); 16 let mut _11: T; 17 let _12: usize; 18 let mut _13: usize; 19 let mut _14: bool; 20 scope 1 { 21 debug a => _3; 22 } 23 24 bb0: { 25 StorageLive(_3); 26- StorageLive(_4); 27- _4 = _1; 28- _3 = [move _4; N]; 29- StorageDead(_4); 30+ _3 = [_1; N]; 31 StorageLive(_5); 32 StorageLive(_6); 33 StorageLive(_7); 34 _7 = const 0_usize; 35 _8 = Len(_3); 36- _9 = Lt(_7, _8); 37- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue]; 38+ _9 = Lt(const 0_usize, _8); 39+ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind continue]; 40 } 41 42 bb1: { 43 _6 = _3[_7]; 44 _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue]; 45 } 46 47 bb2: { 48 StorageDead(_6); 49 StorageDead(_7); 50 StorageDead(_5); 51 StorageLive(_10); 52 StorageLive(_11); 53 StorageLive(_12); 54 _12 = _2; 55- _13 = Len(_3); 56- _14 = Lt(_12, _13); 57- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue]; 58+ _14 = Lt(_2, _8); 59+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue]; 60 } 61 62 bb3: { 63 _11 = _3[_12]; 64 _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue]; 65 } 66 67 bb4: { 68 StorageDead(_11); 69 StorageDead(_12); 70 StorageDead(_10); 71 _0 = const (); 72 StorageDead(_3); 73 return; 74 } 75 } 76