about summary refs log tree commit diff
path: root/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-04-23 09:38:37 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-04-23 17:10:53 +0000
commit332b7f51d68ced4addab04f34d5f18e35df2f22d (patch)
tree60bd2943bf8abf1d2c72cfb16453fcbe8790d936 /tests/mir-opt/pre-codegen/optimizes_into_variable.rs
parent9e540df7931a32ca286eb2e907afde78b718fd17 (diff)
downloadrust-332b7f51d68ced4addab04f34d5f18e35df2f22d.tar.gz
rust-332b7f51d68ced4addab04f34d5f18e35df2f22d.zip
Add mir-opt tests to track MIR quality.
Diffstat (limited to 'tests/mir-opt/pre-codegen/optimizes_into_variable.rs')
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
new file mode 100644
index 00000000000..bb32cd3afb1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -0,0 +1,18 @@
+// ignore-wasm32 compiled with panic=abort by default
+// compile-flags: -C overflow-checks=on
+
+struct Point {
+    x: u32,
+    y: u32,
+}
+
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR optimizes_into_variable.main.ScalarReplacementOfAggregates.diff
+// EMIT_MIR optimizes_into_variable.main.ConstProp.diff
+// EMIT_MIR optimizes_into_variable.main.SimplifyLocals-final.after.mir
+// EMIT_MIR optimizes_into_variable.main.PreCodegen.after.mir
+fn main() {
+    let x = 2 + 2;
+    let y = [0, 1, 2, 3, 4, 5][3];
+    let z = (Point { x: 12, y: 42}).y;
+}