about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2024-06-28 13:02:08 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2024-07-13 12:02:10 +0000
commit7ac7f135e3938c55e2fccb194ece52519c1797d2 (patch)
tree5ad5fb9a4bb5844eaeac76f9ecdc5fb0bafff6a2 /tests
parentaf876626b057bd4c1cf73897b8313f1d09ea6176 (diff)
downloadrust-7ac7f135e3938c55e2fccb194ece52519c1797d2.tar.gz
rust-7ac7f135e3938c55e2fccb194ece52519c1797d2.zip
Propagate places through assignments.
Diffstat (limited to 'tests')
-rw-r--r--tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff22
-rw-r--r--tests/mir-opt/dataflow-const-prop/aggregate_copy.rs10
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.rs2
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff14
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff14
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff4
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff4
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.rs3
-rw-r--r--tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff3
-rw-r--r--tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff3
-rw-r--r--tests/mir-opt/jump_threading.rs2
12 files changed, 64 insertions, 23 deletions
diff --git a/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff
index 19bbbad5123..1aeaaff21dc 100644
--- a/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff
@@ -22,19 +22,25 @@
           StorageLive(_1);
           _1 = const Foo;
           StorageLive(_2);
-          _2 = _1;
+-         _2 = _1;
++         _2 = const (5_u32, 3_u32);
           StorageLive(_3);
-          _3 = (_2.1: u32);
+-         _3 = (_2.1: u32);
++         _3 = const 3_u32;
           StorageLive(_4);
           StorageLive(_5);
-          _5 = _3;
-          _4 = Ge(move _5, const 2_u32);
-          switchInt(move _4) -> [0: bb2, otherwise: bb1];
+-         _5 = _3;
+-         _4 = Ge(move _5, const 2_u32);
+-         switchInt(move _4) -> [0: bb2, otherwise: bb1];
++         _5 = const 3_u32;
++         _4 = const true;
++         switchInt(const true) -> [0: bb2, otherwise: bb1];
       }
   
       bb1: {
           StorageDead(_5);
-          _0 = (_2.0: u32);
+-         _0 = (_2.0: u32);
++         _0 = const 5_u32;
           goto -> bb3;
       }
   
@@ -51,5 +57,9 @@
           StorageDead(_1);
           return;
       }
++ }
++ 
++ ALLOC0 (size: 8, align: 4) {
++     05 00 00 00 03 00 00 00                         │ ........
   }
   
diff --git a/tests/mir-opt/dataflow-const-prop/aggregate_copy.rs b/tests/mir-opt/dataflow-const-prop/aggregate_copy.rs
index 595f38132ee..aca5f047222 100644
--- a/tests/mir-opt/dataflow-const-prop/aggregate_copy.rs
+++ b/tests/mir-opt/dataflow-const-prop/aggregate_copy.rs
@@ -12,12 +12,14 @@ fn foo() -> u32 {
 
     // CHECK:bb0: {
     // CHECK:    [[a]] = const Foo;
-    // CHECK:    [[b]] = [[a]];
-    // CHECK:    [[c]] = ([[b]].1: u32);
-    // CHECK:    switchInt(move {{_.*}}) -> [0: bb2, otherwise: bb1];
+    // CHECK:    [[b]] = const (5_u32, 3_u32);
+    // CHECK:    [[c]] = const 3_u32;
+    // CHECK:    {{_.*}} = const 3_u32;
+    // CHECK:    {{_.*}} = const true;
+    // CHECK:    switchInt(const true) -> [0: bb2, otherwise: bb1];
 
     // CHECK:bb1: {
-    // CHECK:    _0 = ([[b]].0: u32);
+    // CHECK:    _0 = const 5_u32;
     // CHECK:    goto -> bb3;
 
     // CHECK:bb2: {
diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
index a77eb4708f2..98bd40ab2c3 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
@@ -32,7 +32,7 @@
           StorageDead(_5);
           StorageDead(_4);
 -         _2 = I32(move _3);
-+         _2 = I32(const 0_i32);
++         _2 = const I32(0_i32);
           StorageDead(_3);
           _0 = const ();
           StorageDead(_2);
@@ -43,5 +43,9 @@
 + 
 + ALLOC0 (size: 4, align: 4) {
 +     00 00 00 00                                     │ ....
++ }
++ 
++ ALLOC1 (size: 4, align: 4) {
++     00 00 00 00                                     │ ....
   }
   
diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
index 6e3c48c81dc..6152724c98f 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
@@ -15,6 +15,6 @@ fn main() {
     // CHECK: [[x]] = const I32(0_i32);
     let x = I32(0);
 
-    // CHECK: [[y]] = I32(const 0_i32);
+    // CHECK: [[y]] = const I32(0_i32);
     let y = I32(x.0 + x.0);
 }
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
index 44dd4017409..a023243ad9d 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.32bit.diff
@@ -7,10 +7,20 @@
   
       bb0: {
           StorageLive(_1);
-          _1 = Less;
-          _0 = move _1 as i8 (Transmute);
+-         _1 = Less;
+-         _0 = move _1 as i8 (Transmute);
++         _1 = const Less;
++         _0 = const std::cmp::Ordering::Less as i8 (Transmute);
           StorageDead(_1);
           return;
       }
++ }
++ 
++ ALLOC0 (size: 1, align: 1) {
++     ff                                              │ .
++ }
++ 
++ ALLOC1 (size: 1, align: 1) {
++     ff                                              │ .
   }
   
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
index 44dd4017409..a023243ad9d 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.less_as_i8.DataflowConstProp.64bit.diff
@@ -7,10 +7,20 @@
   
       bb0: {
           StorageLive(_1);
-          _1 = Less;
-          _0 = move _1 as i8 (Transmute);
+-         _1 = Less;
+-         _0 = move _1 as i8 (Transmute);
++         _1 = const Less;
++         _0 = const std::cmp::Ordering::Less as i8 (Transmute);
           StorageDead(_1);
           return;
       }
++ }
++ 
++ ALLOC0 (size: 1, align: 1) {
++     ff                                              │ .
++ }
++ 
++ ALLOC1 (size: 1, align: 1) {
++     ff                                              │ .
   }
   
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
index 0e14676efdf..e4031b65caa 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
@@ -81,7 +81,7 @@
 -         _14 = _6;
 -         _11 = (move _12, move _13, move _14);
 +         _14 = const 11_i32;
-+         _11 = (const 6_i32, move _13, const 11_i32);
++         _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
           StorageDead(_14);
           StorageDead(_13);
           StorageDead(_12);
@@ -99,4 +99,6 @@
 + ALLOC1 (size: 8, align: 4) { .. }
 + 
 + ALLOC2 (size: 8, align: 4) { .. }
++ 
++ ALLOC3 (size: 8, align: 4) { .. }
   
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
index 0e14676efdf..e4031b65caa 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
@@ -81,7 +81,7 @@
 -         _14 = _6;
 -         _11 = (move _12, move _13, move _14);
 +         _14 = const 11_i32;
-+         _11 = (const 6_i32, move _13, const 11_i32);
++         _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
           StorageDead(_14);
           StorageDead(_13);
           StorageDead(_12);
@@ -99,4 +99,6 @@
 + ALLOC1 (size: 8, align: 4) { .. }
 + 
 + ALLOC2 (size: 8, align: 4) { .. }
++ 
++ ALLOC3 (size: 8, align: 4) { .. }
   
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/dataflow-const-prop/tuple.rs
index ed794ca658c..19b675770ab 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.rs
+++ b/tests/mir-opt/dataflow-const-prop/tuple.rs
@@ -23,7 +23,6 @@ fn main() {
     // CHECK: [[c]] = const 11_i32;
     let c = a.0 + a.1 + b;
 
-    // CHECK: [[a2:_.*]] = const (2_i32, 3_i32);
-    // CHECK: [[d]] = (const 6_i32, move [[a2]], const 11_i32);
+    // CHECK: [[d]] = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
     let d = (b, a, c);
 }
diff --git a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff
index ec62ba2feea..0c8e04a1e74 100644
--- a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff
+++ b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff
@@ -29,7 +29,8 @@
           StorageLive(_5);
           _5 = _3;
           _4 = Eq(move _5, const 2_u32);
-          switchInt(move _4) -> [0: bb2, otherwise: bb1];
+-         switchInt(move _4) -> [0: bb2, otherwise: bb1];
++         goto -> bb2;
       }
   
       bb1: {
diff --git a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff
index ec62ba2feea..0c8e04a1e74 100644
--- a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff
+++ b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff
@@ -29,7 +29,8 @@
           StorageLive(_5);
           _5 = _3;
           _4 = Eq(move _5, const 2_u32);
-          switchInt(move _4) -> [0: bb2, otherwise: bb1];
+-         switchInt(move _4) -> [0: bb2, otherwise: bb1];
++         goto -> bb2;
       }
   
       bb1: {
diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs
index 59b5b2c6eea..de290c1ef44 100644
--- a/tests/mir-opt/jump_threading.rs
+++ b/tests/mir-opt/jump_threading.rs
@@ -509,7 +509,7 @@ fn assume(a: u8, b: bool) -> u8 {
 /// Verify that jump threading succeeds seeing through copies of aggregates.
 fn aggregate_copy() -> u32 {
     // CHECK-LABEL: fn aggregate_copy(
-    // CHECK: switchInt(
+    // CHECK-NOT: switchInt(
 
     const Foo: (u32, u32) = (5, 3);