summary refs log tree commit diff
path: root/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff
diff options
context:
space:
mode:
authorSimon Vandel Sillesen <simon.vandel@gmail.com>2020-09-17 18:27:49 +0200
committerSimon Vandel Sillesen <simon.vandel@gmail.com>2020-09-19 15:29:09 +0200
commitcad050b002ff36c65b68833fcd90824eceee1993 (patch)
treefd856d0ed2262362912b23ed3ec8495a60a26fa0 /src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff
parentfd702d2919fe23eeaf59574040d0b29853d44289 (diff)
downloadrust-cad050b002ff36c65b68833fcd90824eceee1993.tar.gz
rust-cad050b002ff36c65b68833fcd90824eceee1993.zip
Add regression test showcasing miscompilation
Diffstat (limited to 'src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff')
-rw-r--r--src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff b/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff
new file mode 100644
index 00000000000..63139285209
--- /dev/null
+++ b/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff
@@ -0,0 +1,30 @@
+- // MIR for `encode` before SimplifyBranchSame
++ // MIR for `encode` after SimplifyBranchSame
+  
+  fn encode(_1: Type) -> Type {
+      debug v => _1;                       // in scope 0 at $DIR/76803_regression.rs:10:15: 10:16
+      let mut _0: Type;                    // return place in scope 0 at $DIR/76803_regression.rs:10:27: 10:31
+      let mut _2: isize;                   // in scope 0 at $DIR/76803_regression.rs:12:9: 12:16
+  
+      bb0: {
+          _2 = discriminant(_1);           // scope 0 at $DIR/76803_regression.rs:12:9: 12:16
+-         switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/76803_regression.rs:12:9: 12:16
++         goto -> bb1;                     // scope 0 at $DIR/76803_regression.rs:12:9: 12:16
+      }
+  
+      bb1: {
+          _0 = move _1;                    // scope 0 at $DIR/76803_regression.rs:13:14: 13:15
+-         goto -> bb3;                     // scope 0 at $DIR/76803_regression.rs:11:5: 14:6
++         goto -> bb2;                     // scope 0 at $DIR/76803_regression.rs:11:5: 14:6
+      }
+  
+      bb2: {
+-         discriminant(_0) = 1;            // scope 0 at $DIR/76803_regression.rs:12:20: 12:27
+-         goto -> bb3;                     // scope 0 at $DIR/76803_regression.rs:11:5: 14:6
+-     }
+- 
+-     bb3: {
+          return;                          // scope 0 at $DIR/76803_regression.rs:15:2: 15:2
+      }
+  }
+