about summary refs log tree commit diff
path: root/tests/mir-opt/building
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-06-17 20:16:53 +0200
committerNadrieril <nadrieril+git@gmail.com>2024-06-22 19:05:48 +0200
commit7b150a161e7c90cc067c1a709a63785b5dc2a5e9 (patch)
tree7ca49c3f35e79b791bc24c1865540f4237bef4e7 /tests/mir-opt/building
parentc0c6c32a45e9ef05d99459a77e39072524ed1dc4 (diff)
downloadrust-7b150a161e7c90cc067c1a709a63785b5dc2a5e9.tar.gz
rust-7b150a161e7c90cc067c1a709a63785b5dc2a5e9.zip
Don't use fake wildcards when we can get the failure block directly
This commit too was obtained by repeatedly inlining and simplifying.
Diffstat (limited to 'tests/mir-opt/building')
-rw-r--r--tests/mir-opt/building/issue_101867.main.built.after.mir21
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir138
2 files changed, 66 insertions, 93 deletions
diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir
index 0f7917dbb5c..5c50b3db5ca 100644
--- a/tests/mir-opt/building/issue_101867.main.built.after.mir
+++ b/tests/mir-opt/building/issue_101867.main.built.after.mir
@@ -27,13 +27,13 @@ fn main() -> () {
         StorageLive(_5);
         PlaceMention(_1);
         _6 = discriminant(_1);
-        switchInt(move _6) -> [1: bb6, otherwise: bb4];
+        switchInt(move _6) -> [1: bb4, otherwise: bb3];
     }
 
     bb1: {
         StorageLive(_3);
         StorageLive(_4);
-        _4 = begin_panic::<&str>(const "explicit panic") -> bb10;
+        _4 = begin_panic::<&str>(const "explicit panic") -> bb8;
     }
 
     bb2: {
@@ -43,12 +43,11 @@ fn main() -> () {
     }
 
     bb3: {
-        FakeRead(ForMatchedPlace(None), _1);
-        unreachable;
+        goto -> bb7;
     }
 
     bb4: {
-        goto -> bb9;
+        falseEdge -> [real: bb6, imaginary: bb3];
     }
 
     bb5: {
@@ -56,14 +55,6 @@ fn main() -> () {
     }
 
     bb6: {
-        falseEdge -> [real: bb8, imaginary: bb4];
-    }
-
-    bb7: {
-        goto -> bb4;
-    }
-
-    bb8: {
         _5 = ((_1 as Some).0: u8);
         _0 = const ();
         StorageDead(_5);
@@ -71,12 +62,12 @@ fn main() -> () {
         return;
     }
 
-    bb9: {
+    bb7: {
         StorageDead(_5);
         goto -> bb1;
     }
 
-    bb10 (cleanup): {
+    bb8 (cleanup): {
         resume;
     }
 }
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
index fd8eb370ca9..3e16efe6980 100644
--- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
@@ -19,22 +19,21 @@ fn test_complex() -> () {
     bb0: {
         StorageLive(_1);
         StorageLive(_2);
-        _2 = E::f() -> [return: bb1, unwind: bb38];
+        _2 = E::f() -> [return: bb1, unwind: bb34];
     }
 
     bb1: {
         PlaceMention(_2);
         _3 = discriminant(_2);
-        switchInt(move _3) -> [0: bb5, otherwise: bb3];
+        switchInt(move _3) -> [0: bb3, otherwise: bb2];
     }
 
     bb2: {
-        FakeRead(ForMatchedPlace(None), _2);
-        unreachable;
+        goto -> bb21;
     }
 
     bb3: {
-        goto -> bb23;
+        falseEdge -> [real: bb5, imaginary: bb2];
     }
 
     bb4: {
@@ -42,175 +41,158 @@ fn test_complex() -> () {
     }
 
     bb5: {
-        falseEdge -> [real: bb7, imaginary: bb3];
+        StorageLive(_4);
+        _4 = always_true() -> [return: bb6, unwind: bb34];
     }
 
     bb6: {
-        goto -> bb3;
+        switchInt(move _4) -> [0: bb8, otherwise: bb7];
     }
 
     bb7: {
-        StorageLive(_4);
-        _4 = always_true() -> [return: bb8, unwind: bb38];
-    }
-
-    bb8: {
-        switchInt(move _4) -> [0: bb10, otherwise: bb9];
-    }
-
-    bb9: {
         StorageLive(_5);
         StorageLive(_6);
         StorageLive(_7);
         _7 = Droppy(const 0_u8);
         _6 = (_7.0: u8);
         _5 = Gt(move _6, const 0_u8);
-        switchInt(move _5) -> [0: bb12, otherwise: bb11];
+        switchInt(move _5) -> [0: bb10, otherwise: bb9];
     }
 
-    bb10: {
-        goto -> bb16;
+    bb8: {
+        goto -> bb14;
     }
 
-    bb11: {
-        drop(_7) -> [return: bb13, unwind: bb38];
+    bb9: {
+        drop(_7) -> [return: bb11, unwind: bb34];
     }
 
-    bb12: {
-        goto -> bb14;
+    bb10: {
+        goto -> bb12;
     }
 
-    bb13: {
+    bb11: {
         StorageDead(_7);
         StorageDead(_6);
-        goto -> bb20;
+        goto -> bb18;
     }
 
-    bb14: {
-        drop(_7) -> [return: bb15, unwind: bb38];
+    bb12: {
+        drop(_7) -> [return: bb13, unwind: bb34];
     }
 
-    bb15: {
+    bb13: {
         StorageDead(_7);
         StorageDead(_6);
-        goto -> bb16;
+        goto -> bb14;
     }
 
-    bb16: {
+    bb14: {
         StorageLive(_8);
         StorageLive(_9);
         StorageLive(_10);
         _10 = Droppy(const 1_u8);
         _9 = (_10.0: u8);
         _8 = Gt(move _9, const 1_u8);
-        switchInt(move _8) -> [0: bb18, otherwise: bb17];
+        switchInt(move _8) -> [0: bb16, otherwise: bb15];
     }
 
-    bb17: {
-        drop(_10) -> [return: bb19, unwind: bb38];
+    bb15: {
+        drop(_10) -> [return: bb17, unwind: bb34];
     }
 
-    bb18: {
-        goto -> bb21;
+    bb16: {
+        goto -> bb19;
     }
 
-    bb19: {
+    bb17: {
         StorageDead(_10);
         StorageDead(_9);
-        goto -> bb20;
+        goto -> bb18;
     }
 
-    bb20: {
+    bb18: {
         _1 = const ();
-        goto -> bb24;
+        goto -> bb22;
     }
 
-    bb21: {
-        drop(_10) -> [return: bb22, unwind: bb38];
+    bb19: {
+        drop(_10) -> [return: bb20, unwind: bb34];
     }
 
-    bb22: {
+    bb20: {
         StorageDead(_10);
         StorageDead(_9);
-        goto -> bb23;
+        goto -> bb21;
     }
 
-    bb23: {
+    bb21: {
         _1 = const ();
-        goto -> bb24;
+        goto -> bb22;
     }
 
-    bb24: {
+    bb22: {
         StorageDead(_8);
         StorageDead(_5);
         StorageDead(_4);
         StorageDead(_2);
         StorageDead(_1);
         StorageLive(_11);
-        _11 = always_true() -> [return: bb25, unwind: bb38];
+        _11 = always_true() -> [return: bb23, unwind: bb34];
     }
 
-    bb25: {
-        switchInt(move _11) -> [0: bb27, otherwise: bb26];
+    bb23: {
+        switchInt(move _11) -> [0: bb25, otherwise: bb24];
     }
 
-    bb26: {
-        goto -> bb36;
+    bb24: {
+        goto -> bb32;
     }
 
-    bb27: {
-        goto -> bb28;
+    bb25: {
+        goto -> bb26;
     }
 
-    bb28: {
+    bb26: {
         StorageLive(_12);
-        _12 = E::f() -> [return: bb29, unwind: bb38];
+        _12 = E::f() -> [return: bb27, unwind: bb34];
     }
 
-    bb29: {
+    bb27: {
         PlaceMention(_12);
         _13 = discriminant(_12);
-        switchInt(move _13) -> [1: bb33, otherwise: bb31];
-    }
-
-    bb30: {
-        FakeRead(ForMatchedPlace(None), _12);
-        unreachable;
+        switchInt(move _13) -> [1: bb29, otherwise: bb28];
     }
 
-    bb31: {
-        goto -> bb36;
-    }
-
-    bb32: {
-        goto -> bb30;
+    bb28: {
+        goto -> bb32;
     }
 
-    bb33: {
-        falseEdge -> [real: bb35, imaginary: bb31];
+    bb29: {
+        falseEdge -> [real: bb31, imaginary: bb28];
     }
 
-    bb34: {
-        goto -> bb31;
+    bb30: {
+        goto -> bb28;
     }
 
-    bb35: {
+    bb31: {
         _0 = const ();
-        goto -> bb37;
+        goto -> bb33;
     }
 
-    bb36: {
+    bb32: {
         _0 = const ();
-        goto -> bb37;
+        goto -> bb33;
     }
 
-    bb37: {
+    bb33: {
         StorageDead(_11);
         StorageDead(_12);
         return;
     }
 
-    bb38 (cleanup): {
+    bb34 (cleanup): {
         resume;
     }
 }