about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJannis Christopher Köhl <mail@koehl.dev>2022-08-30 00:57:49 +0200
committerJannis Christopher Köhl <mail@koehl.dev>2022-11-07 10:35:09 +0100
commit93ee80623366622cc4ce019caa7b90ce55eb14e2 (patch)
treec8b830a65c7f63c305be545bef6a665c328fd7e5
parent56ff16d19f2a34eaf54bf30a2d71e6924ca1bff0 (diff)
downloadrust-93ee80623366622cc4ce019caa7b90ce55eb14e2.tar.gz
rust-93ee80623366622cc4ce019caa7b90ce55eb14e2.zip
Update test results
-rw-r--r--src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff34
-rw-r--r--src/test/mir-opt/dataflow-const-prop/issue_81605.rs10
-rw-r--r--src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff28
3 files changed, 56 insertions, 16 deletions
diff --git a/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff
new file mode 100644
index 00000000000..075cf35a545
--- /dev/null
+++ b/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff
@@ -0,0 +1,34 @@
+- // MIR for `f` before DataflowConstProp
++ // MIR for `f` after DataflowConstProp
+  
+  fn f() -> usize {
+      let mut _0: usize;                   // return place in scope 0 at $DIR/issue_81605.rs:+0:11: +0:16
+      let mut _1: usize;                   // in scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+      let mut _2: bool;                    // in scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+  
+      bb0: {
+          StorageLive(_1);                 // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+          StorageLive(_2);                 // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+          _2 = const true;                 // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+-         switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
++         switchInt(const true) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16
+      }
+  
+      bb1: {
+          _1 = const 1_usize;              // scope 0 at $DIR/issue_81605.rs:+1:19: +1:20
+          goto -> bb3;                     // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+      }
+  
+      bb2: {
+          _1 = const 2_usize;              // scope 0 at $DIR/issue_81605.rs:+1:30: +1:31
+          goto -> bb3;                     // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33
+      }
+  
+      bb3: {
+          StorageDead(_2);                 // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33
+          _0 = Add(const 1_usize, move _1); // scope 0 at $DIR/issue_81605.rs:+1:5: +1:33
+          StorageDead(_1);                 // scope 0 at $DIR/issue_81605.rs:+1:32: +1:33
+          return;                          // scope 0 at $DIR/issue_81605.rs:+2:2: +2:2
+      }
+  }
+  
diff --git a/src/test/mir-opt/dataflow-const-prop/issue_81605.rs b/src/test/mir-opt/dataflow-const-prop/issue_81605.rs
new file mode 100644
index 00000000000..d75e2a28bef
--- /dev/null
+++ b/src/test/mir-opt/dataflow-const-prop/issue_81605.rs
@@ -0,0 +1,10 @@
+// unit-test: DataflowConstProp
+
+// EMIT_MIR issue_81605.f.DataflowConstProp.diff
+fn f() -> usize {
+    1 + if true { 1 } else { 2 }
+}
+
+fn main() {
+    f();
+}
diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff
index f854d93125a..b305fa16d1b 100644
--- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff
+++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff
@@ -1,6 +1,6 @@
 - // MIR for `main` before SimplifyArmIdentity
 + // MIR for `main` after SimplifyArmIdentity
-
+  
   fn main() -> () {
       let mut _0: ();                      // return place in scope 0 at $DIR/issue_73223.rs:+0:11: +0:11
       let _1: i32;                         // in scope 0 at $DIR/issue_73223.rs:+1:9: +1:14
@@ -47,7 +47,7 @@
       scope 2 {
           debug v => _4;                   // in scope 2 at $DIR/issue_73223.rs:+2:14: +2:15
       }
-
+  
       bb0: {
           StorageLive(_1);                 // scope 0 at $DIR/issue_73223.rs:+1:9: +1:14
           StorageLive(_2);                 // scope 0 at $DIR/issue_73223.rs:+1:23: +1:30
@@ -57,18 +57,18 @@
           _3 = const 1_isize;              // scope 0 at $DIR/issue_73223.rs:+1:23: +1:30
           goto -> bb3;                     // scope 0 at $DIR/issue_73223.rs:+1:17: +1:30
       }
-
+  
       bb1: {
           nop;                             // scope 0 at $DIR/issue_73223.rs:+3:17: +3:23
           StorageDead(_2);                 // scope 0 at $DIR/issue_73223.rs:+4:6: +4:7
           StorageDead(_1);                 // scope 0 at $DIR/issue_73223.rs:+8:1: +8:2
           return;                          // scope 0 at $DIR/issue_73223.rs:+8:2: +8:2
       }
-
+  
       bb2: {
           unreachable;                     // scope 0 at $DIR/issue_73223.rs:+1:23: +1:30
       }
-
+  
       bb3: {
           StorageLive(_4);                 // scope 0 at $DIR/issue_73223.rs:+2:14: +2:15
           _4 = ((_2 as Some).0: i32);      // scope 0 at $DIR/issue_73223.rs:+2:14: +2:15
@@ -104,21 +104,17 @@
           StorageLive(_15);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageLive(_16);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageLive(_17);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
--	      _17 = (*_13);                    // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+	      _17 = const 1_i32;               // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+          _17 = const 1_i32;               // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageLive(_18);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           _18 = const 1_i32;               // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
--	      _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+	      _16 = const true;                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+          _16 = const true;                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_18);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_17);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
--	      _15 = Not(move _16);             // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+	      _15 = const false;               // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+          _15 = const false;               // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_16);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
--	      switchInt(move _15) -> [false: bb5, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-+	      goto -> bb5;                     // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+          goto -> bb5;                     // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
       }
-
+  
       bb4: {
           StorageLive(_20);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           Deinit(_20);                     // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
@@ -148,7 +144,7 @@
                                            // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
                                            // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) }
       }
-
+  
       bb5: {
           nop;                             // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
           StorageDead(_15);                // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
@@ -162,4 +158,4 @@
           return;                          // scope 0 at $DIR/issue_73223.rs:+8:2: +8:2
       }
   }
-
+