Skip to content

Commit e3c0f1b

Browse files
committed
Revert "inline: Drop debuginfos if drop var debuginfos"
This reverts commit b28d4ec.
1 parent b28d4ec commit e3c0f1b

11 files changed

+42
-11
lines changed

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,13 +1430,6 @@ impl<'tcx> BasicBlockData<'tcx> {
14301430
pub fn strip_nops(&mut self) {
14311431
self.retain_statements(|stmt| !matches!(stmt.kind, StatementKind::Nop))
14321432
}
1433-
1434-
pub fn drop_debuginfo(&mut self) {
1435-
self.after_last_stmt_debuginfos = Vec::new();
1436-
for stmt in self.statements.iter_mut() {
1437-
stmt.debuginfos = Vec::new();
1438-
}
1439-
}
14401433
}
14411434

14421435
///////////////////////////////////////////////////////////////////////////

compiler/rustc_mir_transform/src/inline.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,6 @@ fn inline_call<'tcx, I: Inliner<'tcx>>(
992992
// people working on rust can build with or without debuginfo while
993993
// still getting consistent results from the mir-opt tests.
994994
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
995-
} else {
996-
for bb in callee_body.basic_blocks_mut() {
997-
bb.drop_debuginfo();
998-
}
999995
}
1000996
caller_body.basic_blocks_mut().append(callee_body.basic_blocks_mut());
1001997

tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
+ StorageLive(_12);
6666
+ StorageLive(_8);
6767
+ StorageLive(_9);
68+
+ // DBG: AssignRef(_11, ((*_6).0: alloc::raw_vec::RawVec<A>))
69+
+ // DBG: AssignRef(_12, (((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner))
6870
+ StorageLive(_13);
6971
+ _13 = copy (((((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
7072
+ _9 = copy _13 as *mut A (Transmute);

tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@
233233
+ StorageLive(_50);
234234
+ StorageLive(_42);
235235
+ StorageLive(_43);
236+
+ // DBG: AssignRef(_46, _19)
237+
+ // DBG: AssignRef(_47, (_19.0: &mut std::future::Ready<()>))
236238
+ _45 = copy (_19.0: &mut std::future::Ready<()>);
239+
+ // DBG: AssignRef(_44, ((*_45).0: std::option::Option<()>))
237240
+ StorageLive(_48);
238241
+ _48 = Option::<()>::None;
239242
+ _43 = copy ((*_45).0: std::option::Option<()>);

tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@
250250
+ StorageLive(_52);
251251
+ StorageLive(_44);
252252
+ StorageLive(_45);
253+
+ // DBG: AssignRef(_48, _19)
254+
+ // DBG: AssignRef(_49, (_19.0: &mut std::future::Ready<()>))
253255
+ _47 = copy (_19.0: &mut std::future::Ready<()>);
256+
+ // DBG: AssignRef(_46, ((*_47).0: std::option::Option<()>))
254257
+ StorageLive(_50);
255258
+ _50 = Option::<()>::None;
256259
+ _45 = copy ((*_47).0: std::option::Option<()>);

tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-abort.mir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn num_to_digit(_1: char) -> u32 {
66
let mut _4: std::option::Option<u32>;
77
scope 1 (inlined char::methods::<impl char>::is_digit) {
88
let _2: std::option::Option<u32>;
9+
let mut _7: &std::option::Option<u32>;
910
scope 2 (inlined Option::<u32>::is_some) {
1011
let mut _3: isize;
1112
}
@@ -18,14 +19,17 @@ fn num_to_digit(_1: char) -> u32 {
1819
}
1920

2021
bb0: {
22+
StorageLive(_7);
2123
StorageLive(_2);
2224
_2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable];
2325
}
2426

2527
bb1: {
28+
// DBG: AssignRef(_7, _2)
2629
StorageLive(_3);
2730
_3 = discriminant(_2);
2831
StorageDead(_2);
32+
StorageDead(_7);
2933
switchInt(move _3) -> [1: bb2, otherwise: bb7];
3034
}
3135

tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.32bit.panic-unwind.mir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn num_to_digit(_1: char) -> u32 {
66
let mut _4: std::option::Option<u32>;
77
scope 1 (inlined char::methods::<impl char>::is_digit) {
88
let _2: std::option::Option<u32>;
9+
let mut _7: &std::option::Option<u32>;
910
scope 2 (inlined Option::<u32>::is_some) {
1011
let mut _3: isize;
1112
}
@@ -18,14 +19,17 @@ fn num_to_digit(_1: char) -> u32 {
1819
}
1920

2021
bb0: {
22+
StorageLive(_7);
2123
StorageLive(_2);
2224
_2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue];
2325
}
2426

2527
bb1: {
28+
// DBG: AssignRef(_7, _2)
2629
StorageLive(_3);
2730
_3 = discriminant(_2);
2831
StorageDead(_2);
32+
StorageDead(_7);
2933
switchInt(move _3) -> [1: bb2, otherwise: bb7];
3034
}
3135

tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-abort.mir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn num_to_digit(_1: char) -> u32 {
66
let mut _4: std::option::Option<u32>;
77
scope 1 (inlined char::methods::<impl char>::is_digit) {
88
let _2: std::option::Option<u32>;
9+
let mut _7: &std::option::Option<u32>;
910
scope 2 (inlined Option::<u32>::is_some) {
1011
let mut _3: isize;
1112
}
@@ -18,14 +19,17 @@ fn num_to_digit(_1: char) -> u32 {
1819
}
1920

2021
bb0: {
22+
StorageLive(_7);
2123
StorageLive(_2);
2224
_2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable];
2325
}
2426

2527
bb1: {
28+
// DBG: AssignRef(_7, _2)
2629
StorageLive(_3);
2730
_3 = discriminant(_2);
2831
StorageDead(_2);
32+
StorageDead(_7);
2933
switchInt(move _3) -> [1: bb2, otherwise: bb7];
3034
}
3135

tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.64bit.panic-unwind.mir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn num_to_digit(_1: char) -> u32 {
66
let mut _4: std::option::Option<u32>;
77
scope 1 (inlined char::methods::<impl char>::is_digit) {
88
let _2: std::option::Option<u32>;
9+
let mut _7: &std::option::Option<u32>;
910
scope 2 (inlined Option::<u32>::is_some) {
1011
let mut _3: isize;
1112
}
@@ -18,14 +19,17 @@ fn num_to_digit(_1: char) -> u32 {
1819
}
1920

2021
bb0: {
22+
StorageLive(_7);
2123
StorageLive(_2);
2224
_2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue];
2325
}
2426

2527
bb1: {
28+
// DBG: AssignRef(_7, _2)
2629
StorageLive(_3);
2730
_3 = discriminant(_2);
2831
StorageDead(_2);
32+
StorageDead(_7);
2933
switchInt(move _3) -> [1: bb2, otherwise: bb7];
3034
}
3135

tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
66
let mut _0: u16;
77
scope 1 (inlined <u16 as Step>::forward) {
88
let mut _8: u16;
9+
let mut _9: &std::option::Option<u16>;
10+
let _10: std::option::Option<u16>;
911
scope 2 {
1012
}
1113
scope 3 (inlined <u16 as Step>::forward_checked) {
@@ -32,6 +34,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
3234
}
3335

3436
bb0: {
37+
StorageLive(_9);
38+
StorageLive(_10);
3539
StorageLive(_4);
3640
StorageLive(_3);
3741
_3 = Gt(copy _2, const 65535_usize);
@@ -51,6 +55,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
5155
bb2: {
5256
StorageDead(_5);
5357
StorageDead(_6);
58+
// DBG: AssignRef(_9, _10)
5459
goto -> bb7;
5560
}
5661

@@ -61,11 +66,13 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
6166
bb4: {
6267
StorageDead(_5);
6368
StorageDead(_6);
69+
// DBG: AssignRef(_9, _10)
6470
goto -> bb6;
6571
}
6672

6773
bb5: {
6874
StorageDead(_3);
75+
// DBG: AssignRef(_9, _10)
6976
goto -> bb6;
7077
}
7178

@@ -79,6 +86,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
7986
_0 = Add(copy _1, copy _8);
8087
StorageDead(_8);
8188
StorageDead(_4);
89+
StorageDead(_10);
90+
StorageDead(_9);
8291
return;
8392
}
8493
}

tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
66
let mut _0: u16;
77
scope 1 (inlined <u16 as Step>::forward) {
88
let mut _8: u16;
9+
let mut _9: &std::option::Option<u16>;
10+
let _10: std::option::Option<u16>;
911
scope 2 {
1012
}
1113
scope 3 (inlined <u16 as Step>::forward_checked) {
@@ -32,6 +34,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
3234
}
3335

3436
bb0: {
37+
StorageLive(_9);
38+
StorageLive(_10);
3539
StorageLive(_4);
3640
StorageLive(_3);
3741
_3 = Gt(copy _2, const 65535_usize);
@@ -51,6 +55,7 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
5155
bb2: {
5256
StorageDead(_5);
5357
StorageDead(_6);
58+
// DBG: AssignRef(_9, _10)
5459
goto -> bb7;
5560
}
5661

@@ -61,11 +66,13 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
6166
bb4: {
6267
StorageDead(_5);
6368
StorageDead(_6);
69+
// DBG: AssignRef(_9, _10)
6470
goto -> bb6;
6571
}
6672

6773
bb5: {
6874
StorageDead(_3);
75+
// DBG: AssignRef(_9, _10)
6976
goto -> bb6;
7077
}
7178

@@ -79,6 +86,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 {
7986
_0 = Add(copy _1, copy _8);
8087
StorageDead(_8);
8188
StorageDead(_4);
89+
StorageDead(_10);
90+
StorageDead(_9);
8291
return;
8392
}
8493
}

0 commit comments

Comments
 (0)