change inline_retag to after.mir

This commit is contained in:
Ryan Mehri 2023-10-31 11:58:20 -07:00
parent 1ec10ec77f
commit 2fcb4d92b0
3 changed files with 60 additions and 66 deletions

View File

@ -0,0 +1,59 @@
// MIR for `bar` after Inline
fn bar() -> bool {
let mut _0: bool;
let _1: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
let mut _2: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
let mut _3: &i32;
let _4: &i32;
let _5: i32;
let mut _6: &i32;
let _7: &i32;
let _8: i32;
scope 1 {
debug f => _1;
let mut _9: &i32;
let mut _10: &i32;
scope 2 (inlined foo) {
debug x => _3;
debug y => _6;
let mut _11: i32;
let mut _12: i32;
}
}
bb0: {
StorageLive(_1);
_1 = foo;
StorageLive(_2);
_2 = _1;
StorageLive(_3);
StorageLive(_4);
_10 = const _;
Retag(_10);
_4 = &(*_10);
_3 = &(*_4);
StorageLive(_6);
StorageLive(_7);
_9 = const _;
Retag(_9);
_7 = &(*_9);
_6 = &(*_7);
Retag(_3);
Retag(_6);
StorageLive(_11);
_11 = (*_3);
StorageLive(_12);
_12 = (*_6);
_0 = Eq(move _11, move _12);
StorageDead(_12);
StorageDead(_11);
StorageDead(_6);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
StorageDead(_7);
StorageDead(_4);
return;
}
}

View File

@ -1,65 +0,0 @@
- // MIR for `bar` before Inline
+ // MIR for `bar` after Inline
fn bar() -> bool {
let mut _0: bool;
let _1: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
let mut _2: for<'a, 'b> fn(&'a i32, &'b i32) -> bool {foo};
let mut _3: &i32;
let _4: &i32;
let _5: i32;
let mut _6: &i32;
let _7: &i32;
let _8: i32;
scope 1 {
debug f => _1;
let mut _9: &i32;
let mut _10: &i32;
+ scope 2 (inlined foo) {
+ debug x => _3;
+ debug y => _6;
+ let mut _11: i32;
+ let mut _12: i32;
+ }
}
bb0: {
StorageLive(_1);
_1 = foo;
StorageLive(_2);
_2 = _1;
StorageLive(_3);
StorageLive(_4);
_10 = const _;
Retag(_10);
_4 = &(*_10);
_3 = &(*_4);
StorageLive(_6);
StorageLive(_7);
_9 = const _;
Retag(_9);
_7 = &(*_9);
_6 = &(*_7);
- _0 = move _2(move _3, move _6) -> [return: bb1, unwind continue];
- }
-
- bb1: {
+ Retag(_3);
+ Retag(_6);
+ StorageLive(_11);
+ _11 = (*_3);
+ StorageLive(_12);
+ _12 = (*_6);
+ _0 = Eq(move _11, move _12);
+ StorageDead(_12);
+ StorageDead(_11);
StorageDead(_6);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
StorageDead(_7);
StorageDead(_4);
return;
}
}

View File

@ -6,7 +6,7 @@ fn main() {
println!("{}", bar()); println!("{}", bar());
} }
// EMIT_MIR inline_retag.bar.Inline.diff // EMIT_MIR inline_retag.bar.Inline.after.mir
fn bar() -> bool { fn bar() -> bool {
// CHECK-LABEL: fn bar( // CHECK-LABEL: fn bar(
// CHECK: (inlined foo) // CHECK: (inlined foo)