Skip to content

Commit 8f9e4a5

Browse files
committed
At debuginfo=0, don't inline debuginfo when inlining
1 parent 0d8b334 commit 8f9e4a5

File tree

102 files changed

+771
-1177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+771
-1177
lines changed

compiler/rustc_mir_transform/src/inline.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::mir::visit::*;
1111
use rustc_middle::mir::*;
1212
use rustc_middle::ty::TypeVisitableExt;
1313
use rustc_middle::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
14-
use rustc_session::config::OptLevel;
14+
use rustc_session::config::{DebugInfo, OptLevel};
1515
use rustc_span::source_map::Spanned;
1616
use rustc_span::sym;
1717
use rustc_target::abi::FieldIdx;
@@ -699,7 +699,9 @@ impl<'tcx> Inliner<'tcx> {
699699
// Insert all of the (mapped) parts of the callee body into the caller.
700700
caller_body.local_decls.extend(callee_body.drain_vars_and_temps());
701701
caller_body.source_scopes.extend(&mut callee_body.source_scopes.drain(..));
702-
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
702+
if self.tcx.sess.opts.debuginfo != DebugInfo::None {
703+
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
704+
}
703705
caller_body.basic_blocks_mut().extend(callee_body.basic_blocks_mut().drain(..));
704706

705707
caller_body[callsite.block].terminator = Some(Terminator {

tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
scope 1 {
1010
}
1111
scope 2 (inlined #[track_caller] <u8 as Add>::add) {
12-
debug self => _2;
13-
debug other => _3;
1412
let mut _4: (u8, bool);
1513
}
1614

tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
scope 1 {
1010
}
1111
scope 2 (inlined #[track_caller] <u8 as Add>::add) {
12-
debug self => _2;
13-
debug other => _3;
1412
let mut _4: (u8, bool);
1513
}
1614

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
let _3: std::ptr::Unique<[bool]>;
1313
let mut _4: std::ptr::Unique<[bool; 0]>;
1414
scope 3 {
15-
debug ptr => _3;
1615
}
1716
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1817
let mut _5: std::ptr::NonNull<[bool; 0]>;
1918
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
2019
let _6: *mut [bool; 0];
2120
scope 6 {
22-
debug ptr => _6;
2321
scope 10 (inlined NonNull::<[bool; 0]>::new_unchecked) {
24-
debug ptr => _6;
2522
let mut _8: bool;
2623
let _9: ();
2724
let mut _10: *mut ();
@@ -37,7 +34,6 @@
3734
scope 8 (inlined align_of::<[bool; 0]>) {
3835
}
3936
scope 9 (inlined without_provenance_mut::<[bool; 0]>) {
40-
debug addr => _7;
4137
}
4238
}
4339
}

0 commit comments

Comments
 (0)