1
Fork 0

Add mir opt test for min_align_of -> AlignOf lowering

This commit is contained in:
Gary Guo 2021-09-11 00:54:10 +01:00
parent 1c3409f333
commit cdec87cafa
8 changed files with 180 additions and 151 deletions

View file

@ -0,0 +1,24 @@
- // MIR for `align_of` before LowerIntrinsics
+ // MIR for `align_of` after LowerIntrinsics
fn align_of() -> usize {
let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:18:25: 18:30
bb0: {
- _0 = std::intrinsics::min_align_of::<T>() -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:19:5: 19:40
- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::<T>}, val: Value(Scalar(<ZST>)) }
+ _0 = AlignOf(T); // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
}
bb1: {
return; // scope 0 at $DIR/lower_intrinsics.rs:20:2: 20:2
}
bb2 (cleanup): {
resume; // scope 0 at $DIR/lower_intrinsics.rs:18:1: 20:2
}
}

View file

@ -2,127 +2,127 @@
+ // MIR for `discriminant` after LowerIntrinsics + // MIR for `discriminant` after LowerIntrinsics
fn discriminant(_1: T) -> () { fn discriminant(_1: T) -> () {
debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:68:24: 68:25 debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:73:24: 73:25
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:68:30: 68:30 let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:73:30: 73:30
let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45 let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:43: 70:44 let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:43: 75:44
let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:71:43: 71:45 let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:76:43: 76:45
let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:72:43: 72:47 let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:77:43: 77:47
let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45 StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
_4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
_3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44 _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
- _2 = discriminant_value::<T>(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45 - _2 = discriminant_value::<T>(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:69:5: 69:41 - // + span: $DIR/lower_intrinsics.rs:74:5: 74:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r T) -> <T as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<T>}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r T) -> <T as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<T>}, val: Value(Scalar(<ZST>)) }
+ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45 + _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
} }
bb1: { bb1: {
StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:69:44: 69:45 StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:74:44: 74:45
StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:69:45: 69:46 StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:74:45: 74:46
StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:69:45: 69:46 StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:74:45: 74:46
StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
_19 = const discriminant::<T>::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 _19 = const discriminant::<T>::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
// ty::Const // ty::Const
// + ty: &i32 // + ty: &i32
// + val: Unevaluated(discriminant, [T], Some(promoted[2])) // + val: Unevaluated(discriminant, [T], Some(promoted[2]))
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:70:42: 70:44 // + span: $DIR/lower_intrinsics.rs:75:42: 75:44
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) } // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) }
_7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
_6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44 _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
- _5 = discriminant_value::<i32>(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 - _5 = discriminant_value::<i32>(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:70:5: 70:41 - // + span: $DIR/lower_intrinsics.rs:75:5: 75:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r i32) -> <i32 as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<i32>}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r i32) -> <i32 as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<i32>}, val: Value(Scalar(<ZST>)) }
+ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 + _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45 + goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
} }
bb2: { bb2: {
StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:70:44: 70:45 StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:75:44: 75:45
StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:70:45: 70:46 StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:75:45: 75:46
StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:70:45: 70:46 StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:75:45: 75:46
StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
_18 = const discriminant::<T>::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 _18 = const discriminant::<T>::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
// ty::Const // ty::Const
// + ty: &() // + ty: &()
// + val: Unevaluated(discriminant, [T], Some(promoted[1])) // + val: Unevaluated(discriminant, [T], Some(promoted[1]))
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:71:42: 71:45 // + span: $DIR/lower_intrinsics.rs:76:42: 76:45
// + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) } // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) }
_11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
_10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45 _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
- _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 - _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:71:5: 71:41 - // + span: $DIR/lower_intrinsics.rs:76:5: 76:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r ()) -> <() as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<()>}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r ()) -> <() as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<()>}, val: Value(Scalar(<ZST>)) }
+ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 + _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
+ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46 + goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
} }
bb3: { bb3: {
StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:71:45: 71:46 StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:76:45: 76:46
StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:71:46: 71:47 StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:76:46: 76:47
StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:71:46: 71:47 StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:76:46: 76:47
StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
_17 = const discriminant::<T>::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 _17 = const discriminant::<T>::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
// ty::Const // ty::Const
// + ty: &E // + ty: &E
// + val: Unevaluated(discriminant, [T], Some(promoted[0])) // + val: Unevaluated(discriminant, [T], Some(promoted[0]))
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:72:42: 72:47 // + span: $DIR/lower_intrinsics.rs:77:42: 77:47
// + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) } // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) }
_15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
_14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47 _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
- _13 = discriminant_value::<E>(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 - _13 = discriminant_value::<E>(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:72:5: 72:41 - // + span: $DIR/lower_intrinsics.rs:77:5: 77:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r E) -> <E as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<E>}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r E) -> <E as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<E>}, val: Value(Scalar(<ZST>)) }
+ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 + _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
+ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48 + goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
} }
bb4: { bb4: {
StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:72:47: 72:48 StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:77:47: 77:48
StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:72:48: 72:49 StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:77:48: 77:49
StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:72:48: 72:49 StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:77:48: 77:49
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:68:30: 73:2 _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:73:30: 78:2
drop(_1) -> bb5; // scope 0 at $DIR/lower_intrinsics.rs:73:1: 73:2 drop(_1) -> bb5; // scope 0 at $DIR/lower_intrinsics.rs:78:1: 78:2
} }
bb5: { bb5: {
return; // scope 0 at $DIR/lower_intrinsics.rs:73:2: 73:2 return; // scope 0 at $DIR/lower_intrinsics.rs:78:2: 78:2
} }
bb6 (cleanup): { bb6 (cleanup): {
resume; // scope 0 at $DIR/lower_intrinsics.rs:68:1: 73:2 resume; // scope 0 at $DIR/lower_intrinsics.rs:73:1: 78:2
} }
} }

View file

@ -1,32 +1,32 @@
// MIR for `f_u64` before PreCodegen // MIR for `f_u64` before PreCodegen
fn f_u64() -> () { fn f_u64() -> () {
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16 let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:39:16: 39:16
let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21 scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:40:5: 40:21
debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21 scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:40:5: 40:21
} }
} }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
_1 = const 0_u64; // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 _1 = const 0_u64; // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
_3 = move _1; // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 _3 = move _1; // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
_2 = f_non_zst::<u64>(move _3) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 _2 = f_non_zst::<u64>(move _3) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:35:5: 35:21 // + span: $DIR/lower_intrinsics.rs:40:5: 40:21
// + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(Scalar(<ZST>)) }
} }
bb1: { bb1: {
StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
return; // scope 0 at $DIR/lower_intrinsics.rs:36:2: 36:2 return; // scope 0 at $DIR/lower_intrinsics.rs:41:2: 41:2
} }
} }

View file

@ -1,27 +1,27 @@
// MIR for `f_unit` before PreCodegen // MIR for `f_unit` before PreCodegen
fn f_unit() -> () { fn f_unit() -> () {
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:28:17: 28:17 let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:33:17: 33:17
let mut _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:29:16: 29:18 let mut _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:29:5: 29:19 scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19 debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:29:5: 29:19 scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
} }
} }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:16: 29:18 StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19 StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
_2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19 _2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:29:5: 29:19 // + span: $DIR/lower_intrinsics.rs:34:5: 34:19
// + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar(<ZST>)) }
} }
bb1: { bb1: {
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19 StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:18: 29:19 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:18: 34:19
return; // scope 0 at $DIR/lower_intrinsics.rs:30:2: 30:2 return; // scope 0 at $DIR/lower_intrinsics.rs:35:2: 35:2
} }
} }

View file

@ -2,32 +2,32 @@
+ // MIR for `forget` after LowerIntrinsics + // MIR for `forget` after LowerIntrinsics
fn forget(_1: T) -> () { fn forget(_1: T) -> () {
debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:18:18: 18:19 debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:23:18: 23:19
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:18:24: 18:24 let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:23:24: 23:24
let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31 let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31 StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
_2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31 _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
- _0 = std::intrinsics::forget::<T>(move _2) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32 - _0 = std::intrinsics::forget::<T>(move _2) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:19:5: 19:29 - // + span: $DIR/lower_intrinsics.rs:24:5: 24:29
- // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(Scalar(<ZST>)) }
+ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32 + _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
} }
bb1: { bb1: {
StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:19:31: 19:32 StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:31: 24:32
goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:20:1: 20:2 goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:25:1: 25:2
} }
bb2: { bb2: {
return; // scope 0 at $DIR/lower_intrinsics.rs:20:2: 20:2 return; // scope 0 at $DIR/lower_intrinsics.rs:25:2: 25:2
} }
bb3 (cleanup): { bb3 (cleanup): {
resume; // scope 0 at $DIR/lower_intrinsics.rs:18:1: 20:2 resume; // scope 0 at $DIR/lower_intrinsics.rs:23:1: 25:2
} }
} }

View file

@ -2,34 +2,34 @@
+ // MIR for `non_const` after LowerIntrinsics + // MIR for `non_const` after LowerIntrinsics
fn non_const() -> usize { fn non_const() -> usize {
let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:55:26: 55:31 let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:60:26: 60:31
let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:57:9: 57:18 let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:62:9: 62:18
let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:58:5: 58:14 let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:63:5: 63:14
scope 1 { scope 1 {
debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:57:9: 57:18 debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:62:9: 62:18
} }
bb0: { bb0: {
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:57:9: 57:18 StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:62:9: 62:18
_1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:57:21: 57:51 _1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:62:21: 62:51
// mir::Constant // mir::Constant
// + span: $DIR/lower_intrinsics.rs:57:21: 57:51 // + span: $DIR/lower_intrinsics.rs:62:21: 62:51
// + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(Scalar(<ZST>)) }
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:14 StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:14
_2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:14 _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:14
- _0 = move _2() -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16 - _0 = move _2() -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
+ _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16 + _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16 + goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
} }
bb1: { bb1: {
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:58:15: 58:16 StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:63:15: 63:16
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:59:1: 59:2 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:64:1: 64:2
return; // scope 0 at $DIR/lower_intrinsics.rs:59:2: 59:2 return; // scope 0 at $DIR/lower_intrinsics.rs:64:2: 64:2
} }
bb2 (cleanup): { bb2 (cleanup): {
resume; // scope 0 at $DIR/lower_intrinsics.rs:55:1: 59:2 resume; // scope 0 at $DIR/lower_intrinsics.rs:60:1: 64:2
} }
} }

View file

@ -14,6 +14,11 @@ pub fn size_of<T>() -> usize {
core::intrinsics::size_of::<T>() core::intrinsics::size_of::<T>()
} }
// EMIT_MIR lower_intrinsics.align_of.LowerIntrinsics.diff
pub fn align_of<T>() -> usize {
core::intrinsics::min_align_of::<T>()
}
// EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff // EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff
pub fn forget<T>(t: T) { pub fn forget<T>(t: T) {
core::intrinsics::forget(t) core::intrinsics::forget(t)

View file

@ -2,25 +2,25 @@
+ // MIR for `unreachable` after LowerIntrinsics + // MIR for `unreachable` after LowerIntrinsics
fn unreachable() -> ! { fn unreachable() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:23:25: 23:26 let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:28:25: 28:26
let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:23:27: 25:2 let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:28:27: 30:2
let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:24:14: 24:45 let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:29:14: 29:45
let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:24:14: 24:45 let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:29:14: 29:45
scope 1 { scope 1 {
} }
bb0: { bb0: {
StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:47 StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:29:5: 29:47
StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45 StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
- std::intrinsics::unreachable(); // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45 - std::intrinsics::unreachable(); // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
- // mir::Constant - // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:24:14: 24:43 - // + span: $DIR/lower_intrinsics.rs:29:14: 29:43
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(Scalar(<ZST>)) }
+ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45 + unreachable; // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
} }
bb1 (cleanup): { bb1 (cleanup): {
resume; // scope 0 at $DIR/lower_intrinsics.rs:23:1: 25:2 resume; // scope 0 at $DIR/lower_intrinsics.rs:28:1: 30:2
} }
} }