Skip to content

Commit 0b18ed8

Browse files
committed
Disable the constant debuginfo promotion pass by default
It doesn't work correctly on *-pc-windows-gnu
1 parent 01aec8d commit 0b18ed8

9 files changed

+54
-14
lines changed

compiler/rustc_mir/src/transform/const_debuginfo.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ use rustc_index::{bit_set::BitSet, vec::IndexVec};
1515
pub struct ConstDebugInfo;
1616

1717
impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
18-
fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
18+
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
19+
if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
20+
return;
21+
}
22+
1923
trace!("running ConstDebugInfo on {:?}", body.source);
2024

2125
for (local, constant) in find_optimization_oportunities(body) {

src/test/incremental/hashes/let_expressions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn change_mutability_of_slot() {
8686

8787
#[cfg(not(cfail1))]
8888
#[rustc_clean(cfg="cfail2",
89-
except="hir_owner_nodes,typeck")]
89+
except="hir_owner_nodes,typeck,optimized_mir")]
9090
#[rustc_clean(cfg="cfail3")]
9191
pub fn change_mutability_of_slot() {
9292
let _x: u64 = 0;
@@ -166,7 +166,7 @@ pub fn change_mutability_of_binding_in_pattern() {
166166

167167
#[cfg(not(cfail1))]
168168
#[rustc_clean(cfg="cfail2",
169-
except="hir_owner_nodes,typeck")]
169+
except="hir_owner_nodes,typeck,optimized_mir")]
170170
#[rustc_clean(cfg="cfail3")]
171171
pub fn change_mutability_of_binding_in_pattern() {
172172
let (mut _a, _b) = (99u8, 'q');

src/test/mir-opt/const_debuginfo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -C overflow-checks=no
1+
// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
22

33
struct Point {
44
x: u32,

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22

33
fn main() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
5+
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
56
scope 1 {
6-
debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
7+
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
8+
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
79
scope 2 {
8-
debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
10+
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
11+
let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
912
scope 3 {
10-
debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
13+
debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
1114
}
1215
}
1316
}
1417

1518
bb0: {
19+
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
20+
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
21+
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
22+
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
23+
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
24+
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
1625
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
26+
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
27+
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
28+
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
1729
return; // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
1830
}
1931
}

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir

+15-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@
22

33
fn main() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
5+
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
56
scope 1 {
6-
debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
7+
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
8+
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
79
scope 2 {
8-
debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
10+
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
11+
let _3: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
912
scope 3 {
10-
debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
13+
debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
1114
}
1215
}
1316
}
1417

1518
bb0: {
19+
StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
20+
_1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
21+
StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
22+
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
23+
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
24+
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
1625
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
26+
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
27+
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
28+
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
1729
return; // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
1830
}
1931
}

src/test/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ fn main() -> () {
1111
debug f => _1; // in scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
1212
scope 2 (inlined main::{closure#0}) { // at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
1313
debug x => _5; // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
14+
let _6: (); // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
1415
scope 3 {
15-
debug y => const (); // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
16+
debug y => _6; // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
1617
}
1718
}
1819
}
@@ -26,7 +27,10 @@ fn main() -> () {
2627
(_3.0: ()) = move _4; // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
2728
StorageLive(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
2829
_5 = move (_3.0: ()); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
30+
StorageLive(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
31+
_6 = const (); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
2932
_0 = const (); // scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
33+
StorageDead(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3034
StorageDead(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3135
StorageDead(_4); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10
3236
StorageDead(_3); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10

src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
fn f_u64() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16
55
scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
6-
debug t => const 0_u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
6+
debug t => _2; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
77
let _1: (); // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
88
let mut _2: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
99
scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21

src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
fn change_loop_body() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
5+
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
56
scope 1 {
6-
debug _x => const 0_i32; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
7+
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
78
}
89

910
bb0: {
11+
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
12+
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
1013
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
14+
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
1115
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
1216
}
1317
}

src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
fn change_loop_body() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
5+
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
56
scope 1 {
6-
debug _x => const 0_i32; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
7+
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
78
}
89

910
bb0: {
11+
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
12+
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
1013
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
14+
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
1115
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
1216
}
1317
}

0 commit comments

Comments
 (0)