]> git.lizzy.rs Git - rust.git/commitdiff
Disable the constant debuginfo promotion pass by default
authorWesley Wiser <wwiser@gmail.com>
Mon, 14 Dec 2020 12:35:03 +0000 (07:35 -0500)
committerWesley Wiser <wwiser@gmail.com>
Tue, 15 Dec 2020 00:56:10 +0000 (19:56 -0500)
It doesn't work correctly on *-pc-windows-gnu

compiler/rustc_mir/src/transform/const_debuginfo.rs
src/test/incremental/hashes/let_expressions.rs
src/test/mir-opt/const_debuginfo.rs
src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir
src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir
src/test/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir
src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir
src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir

index ed2c48b356806ca6d63aa75d1b639cfc1ef8fb8b..3cdaf4c7dcd47a5ef4458f9a501423457c93c019 100644 (file)
 pub struct ConstDebugInfo;
 
 impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
-    fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+        if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
+            return;
+        }
+
         trace!("running ConstDebugInfo on {:?}", body.source);
 
         for (local, constant) in find_optimization_oportunities(body) {
index 2c37b2e78ffae9e647e994f2dd6ddf480f68c82d..918e72582d6978289c736000f5d769463f933372 100644 (file)
@@ -86,7 +86,7 @@ pub fn change_mutability_of_slot() {
 
 #[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2",
-    except="hir_owner_nodes,typeck")]
+    except="hir_owner_nodes,typeck,optimized_mir")]
 #[rustc_clean(cfg="cfail3")]
 pub fn change_mutability_of_slot() {
     let _x: u64 = 0;
@@ -166,7 +166,7 @@ pub fn change_mutability_of_binding_in_pattern() {
 
 #[cfg(not(cfail1))]
 #[rustc_clean(cfg="cfail2",
-    except="hir_owner_nodes,typeck")]
+    except="hir_owner_nodes,typeck,optimized_mir")]
 #[rustc_clean(cfg="cfail3")]
 pub fn change_mutability_of_binding_in_pattern() {
     let (mut _a, _b) = (99u8, 'q');
index a66d66c60c7ada26cf1e51d27c787d9491ef23e0..a188da385262395087fabd2fc0d43b6e1d775a8d 100644 (file)
@@ -1,4 +1,4 @@
-// compile-flags: -C overflow-checks=no
+// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
 
 struct Point {
     x: u32,
index e4fbba3abfea185e88b7062500df3c061e069425..a78a6341c299d688243b208e07c6d2796d340cc1 100644 (file)
@@ -2,18 +2,30 @@
 
 fn main() -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
+    let _1: i32;                         // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
     scope 1 {
-        debug x => const 4_i32;          // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        debug x => _1;                   // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        let _2: i32;                     // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
         scope 2 {
-            debug y => const 3_i32;      // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+            debug y => _2;               // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+            let _3: u32;                 // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
             scope 3 {
-                debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+                debug z => _3;           // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
             }
         }
     }
 
     bb0: {
+        StorageLive(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        _1 = const 4_i32;                // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+        StorageLive(_2);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+        _2 = const 3_i32;                // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+        StorageLive(_3);                 // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+        _3 = const 42_u32;               // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
         _0 = const ();                   // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
+        StorageDead(_3);                 // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+        StorageDead(_2);                 // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+        StorageDead(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
         return;                          // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
     }
 }
index e4fbba3abfea185e88b7062500df3c061e069425..a78a6341c299d688243b208e07c6d2796d340cc1 100644 (file)
@@ -2,18 +2,30 @@
 
 fn main() -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
+    let _1: i32;                         // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
     scope 1 {
-        debug x => const 4_i32;          // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        debug x => _1;                   // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        let _2: i32;                     // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
         scope 2 {
-            debug y => const 3_i32;      // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+            debug y => _2;               // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+            let _3: u32;                 // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
             scope 3 {
-                debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+                debug z => _3;           // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
             }
         }
     }
 
     bb0: {
+        StorageLive(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
+        _1 = const 4_i32;                // scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
+        StorageLive(_2);                 // scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
+        _2 = const 3_i32;                // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
+        StorageLive(_3);                 // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
+        _3 = const 42_u32;               // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
         _0 = const ();                   // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
+        StorageDead(_3);                 // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+        StorageDead(_2);                 // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
+        StorageDead(_1);                 // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
         return;                          // scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
     }
 }
index 4abbad2c1efc88685989c63762f56bb2b05b87c6..3d386e3b1756b4b186a9adaa8ecb591a2d8345cf 100644 (file)
@@ -11,8 +11,9 @@ fn main() -> () {
         debug f => _1;                   // in scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
         scope 2 (inlined main::{closure#0}) { // at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
             debug x => _5;               // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+            let _6: ();                  // in scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
             scope 3 {
-                debug y => const ();     // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+                debug y => _6;           // in scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
             }
         }
     }
@@ -26,7 +27,10 @@ fn main() -> () {
         (_3.0: ()) = move _4;            // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
         StorageLive(_5);                 // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
         _5 = move (_3.0: ());            // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+        StorageLive(_6);                 // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+        _6 = const ();                   // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
         _0 = const ();                   // scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
+        StorageDead(_6);                 // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
         StorageDead(_5);                 // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
         StorageDead(_4);                 // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10
         StorageDead(_3);                 // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10
index bd4f148285b1fc0756dd9b152e3da25c510bdaa6..654dd8275c9dec52b350dee0aa441df5f90fbd8f 100644 (file)
@@ -3,7 +3,7 @@
 fn f_u64() -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16
     scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
-        debug t => const 0_u64;          // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
+        debug t => _2;                   // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
         let _1: ();                      // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
         let mut _2: u64;                 // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
         scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
index cb3632e0fb137ef7cd699846391e43a198c64116..dae0cbb65a4b3f871ddfe1a5f333b86cbeb86999 100644 (file)
@@ -2,12 +2,16 @@
 
 fn change_loop_body() -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
+    let mut _1: i32;                     // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
     scope 1 {
-        debug _x => const 0_i32;         // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
+        debug _x => _1;                  // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
     }
 
     bb0: {
+        StorageLive(_1);                 // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
+        _1 = const 0_i32;                // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
         _0 = const ();                   // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
+        StorageDead(_1);                 // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
         return;                          // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
     }
 }
index cb3632e0fb137ef7cd699846391e43a198c64116..dae0cbb65a4b3f871ddfe1a5f333b86cbeb86999 100644 (file)
@@ -2,12 +2,16 @@
 
 fn change_loop_body() -> () {
     let mut _0: ();                      // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
+    let mut _1: i32;                     // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
     scope 1 {
-        debug _x => const 0_i32;         // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
+        debug _x => _1;                  // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
     }
 
     bb0: {
+        StorageLive(_1);                 // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
+        _1 = const 0_i32;                // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
         _0 = const ();                   // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
+        StorageDead(_1);                 // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
         return;                          // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
     }
 }