about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-05-25 23:37:10 +0200
committerJonas Schievink <jonasschievink@gmail.com>2020-09-18 21:23:00 +0200
commit8a7b1c38940e8c0a013dacf52db6a7884f156d3e (patch)
treeddc70b6a48cfb11a512c4190d1e3af071fb8ce69
parent16498953856a41e781da65709f1d111cef66af91 (diff)
downloadrust-8a7b1c38940e8c0a013dacf52db6a7884f156d3e.tar.gz
rust-8a7b1c38940e8c0a013dacf52db6a7884f156d3e.zip
Make nrvo-simple set mir-opt-level=1
The additional copies are due to the lack of copy propagation
-rw-r--r--src/test/mir-opt/nrvo-simple.rs2
-rw-r--r--src/test/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff55
2 files changed, 31 insertions, 26 deletions
diff --git a/src/test/mir-opt/nrvo-simple.rs b/src/test/mir-opt/nrvo-simple.rs
index f0eb711b3f0..ab46d7b94c7 100644
--- a/src/test/mir-opt/nrvo-simple.rs
+++ b/src/test/mir-opt/nrvo-simple.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zmir-opt-level=1
+
 // EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff
 fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
     let mut buf = [0; 1024];
diff --git a/src/test/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff b/src/test/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff
index 924e87ea8c0..f438eaa0027 100644
--- a/src/test/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff
+++ b/src/test/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.diff
@@ -2,39 +2,42 @@
 + // MIR for `nrvo` after RenameReturnPlace
   
   fn nrvo(_1: for<'r> fn(&'r mut [u8; 1024])) -> [u8; 1024] {
-      debug init => _1;                    // in scope 0 at $DIR/nrvo-simple.rs:2:9: 2:13
--     let mut _0: [u8; 1024];              // return place in scope 0 at $DIR/nrvo-simple.rs:2:39: 2:49
-+     let mut _0: [u8; 1024];              // return place in scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
-      let mut _2: [u8; 1024];              // in scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
-      let _3: ();                          // in scope 0 at $DIR/nrvo-simple.rs:4:5: 4:19
-      let mut _4: for<'r> fn(&'r mut [u8; 1024]); // in scope 0 at $DIR/nrvo-simple.rs:4:5: 4:9
-      let mut _5: &mut [u8; 1024];         // in scope 0 at $DIR/nrvo-simple.rs:4:10: 4:18
-      let mut _6: &mut [u8; 1024];         // in scope 0 at $DIR/nrvo-simple.rs:4:10: 4:18
+      debug init => _1;                    // in scope 0 at $DIR/nrvo-simple.rs:4:9: 4:13
+-     let mut _0: [u8; 1024];              // return place in scope 0 at $DIR/nrvo-simple.rs:4:39: 4:49
++     let mut _0: [u8; 1024];              // return place in scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
+      let mut _2: [u8; 1024];              // in scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
+      let _3: ();                          // in scope 0 at $DIR/nrvo-simple.rs:6:5: 6:19
+      let mut _4: for<'r> fn(&'r mut [u8; 1024]); // in scope 0 at $DIR/nrvo-simple.rs:6:5: 6:9
+      let mut _5: &mut [u8; 1024];         // in scope 0 at $DIR/nrvo-simple.rs:6:10: 6:18
+      let mut _6: &mut [u8; 1024];         // in scope 0 at $DIR/nrvo-simple.rs:6:10: 6:18
       scope 1 {
--         debug buf => _2;                 // in scope 1 at $DIR/nrvo-simple.rs:3:9: 3:16
-+         debug buf => _0;                 // in scope 1 at $DIR/nrvo-simple.rs:3:9: 3:16
+-         debug buf => _2;                 // in scope 1 at $DIR/nrvo-simple.rs:5:9: 5:16
++         debug buf => _0;                 // in scope 1 at $DIR/nrvo-simple.rs:5:9: 5:16
       }
   
       bb0: {
--         StorageLive(_2);                 // scope 0 at $DIR/nrvo-simple.rs:3:9: 3:16
--         _2 = [const 0_u8; 1024];         // scope 0 at $DIR/nrvo-simple.rs:3:19: 3:28
-+         _0 = [const 0_u8; 1024];         // scope 0 at $DIR/nrvo-simple.rs:3:19: 3:28
-          StorageLive(_3);                 // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19
-          StorageLive(_5);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
-          StorageLive(_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
--         _6 = &mut _2;                    // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
-+         _6 = &mut _0;                    // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
-          _5 = &mut (*_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:10: 4:18
-          _3 = move _1(move _5) -> bb1;    // scope 1 at $DIR/nrvo-simple.rs:4:5: 4:19
+-         StorageLive(_2);                 // scope 0 at $DIR/nrvo-simple.rs:5:9: 5:16
+-         _2 = [const 0_u8; 1024];         // scope 0 at $DIR/nrvo-simple.rs:5:19: 5:28
++         _0 = [const 0_u8; 1024];         // scope 0 at $DIR/nrvo-simple.rs:5:19: 5:28
+          StorageLive(_3);                 // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:19
+          StorageLive(_4);                 // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:9
+          _4 = _1;                         // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:9
+          StorageLive(_5);                 // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
+          StorageLive(_6);                 // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
+-         _6 = &mut _2;                    // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
++         _6 = &mut _0;                    // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
+          _5 = &mut (*_6);                 // scope 1 at $DIR/nrvo-simple.rs:6:10: 6:18
+          _3 = move _4(move _5) -> bb1;    // scope 1 at $DIR/nrvo-simple.rs:6:5: 6:19
       }
   
       bb1: {
-          StorageDead(_5);                 // scope 1 at $DIR/nrvo-simple.rs:4:18: 4:19
-          StorageDead(_6);                 // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20
-          StorageDead(_3);                 // scope 1 at $DIR/nrvo-simple.rs:4:19: 4:20
--         _0 = _2;                         // scope 1 at $DIR/nrvo-simple.rs:5:5: 5:8
--         StorageDead(_2);                 // scope 0 at $DIR/nrvo-simple.rs:6:1: 6:2
-          return;                          // scope 0 at $DIR/nrvo-simple.rs:6:2: 6:2
+          StorageDead(_5);                 // scope 1 at $DIR/nrvo-simple.rs:6:18: 6:19
+          StorageDead(_4);                 // scope 1 at $DIR/nrvo-simple.rs:6:18: 6:19
+          StorageDead(_6);                 // scope 1 at $DIR/nrvo-simple.rs:6:19: 6:20
+          StorageDead(_3);                 // scope 1 at $DIR/nrvo-simple.rs:6:19: 6:20
+-         _0 = _2;                         // scope 1 at $DIR/nrvo-simple.rs:7:5: 7:8
+-         StorageDead(_2);                 // scope 0 at $DIR/nrvo-simple.rs:8:1: 8:2
+          return;                          // scope 0 at $DIR/nrvo-simple.rs:8:2: 8:2
       }
   }