about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-10-18 17:30:28 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-10-31 22:55:59 +0000
commite65ec7d8f1a01a5eec62fb71865f0a124aec1ead (patch)
treea2dc7bf19ecfc00c03142c0849062445d1db8549
parent3d454707ab42dc663c33052b010976e6ada97e10 (diff)
downloadrust-e65ec7d8f1a01a5eec62fb71865f0a124aec1ead.tar.gz
rust-e65ec7d8f1a01a5eec62fb71865f0a124aec1ead.zip
FileCheck const_debuginfo.
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff91
-rw-r--r--tests/mir-opt/const_debuginfo.rs17
2 files changed, 66 insertions, 42 deletions
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index f5d822520a7..87c07279552 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -4,6 +4,12 @@
   fn main() -> () {
       let mut _0: ();
       let _1: u8;
+      let mut _5: u8;
+      let mut _6: u8;
+      let mut _7: u8;
+      let mut _8: u8;
+      let mut _14: u32;
+      let mut _15: u32;
       scope 1 {
 -         debug x => _1;
 +         debug x => const 1_u8;
@@ -19,34 +25,23 @@
                   scope 4 {
 -                     debug sum => _4;
 +                     debug sum => const 6_u8;
-                      let _5: &str;
+                      let _9: &str;
                       scope 5 {
--                         debug s => _5;
+-                         debug s => _9;
 +                         debug s => const "hello, world!";
-                          let _8: bool;
-                          let _9: bool;
-                          let _10: u32;
+                          let _10: (bool, bool, u32);
                           scope 6 {
--                             debug ((f: (bool, bool, u32)).0: bool) => _8;
--                             debug ((f: (bool, bool, u32)).1: bool) => _9;
--                             debug ((f: (bool, bool, u32)).2: u32) => _10;
-+                             debug ((f: (bool, bool, u32)).0: bool) => const true;
-+                             debug ((f: (bool, bool, u32)).1: bool) => const false;
-+                             debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
-                              let _6: std::option::Option<u16>;
+                              debug f => _10;
+                              let _11: std::option::Option<u16>;
                               scope 7 {
--                                 debug o => _6;
-+                                 debug o => const Option::<u16>::Some(99_u16);
-                                  let _11: u32;
-                                  let _12: u32;
+                                  debug o => _11;
+                                  let _12: Point;
                                   scope 8 {
--                                     debug ((p: Point).0: u32) => _11;
--                                     debug ((p: Point).1: u32) => _12;
-+                                     debug ((p: Point).0: u32) => const 32_u32;
-+                                     debug ((p: Point).1: u32) => const 32_u32;
-                                      let _7: u32;
+-                                     debug p => _12;
++                                     debug p => const Point {{ x: 32_u32, y: 32_u32 }};
+                                      let _13: u32;
                                       scope 9 {
--                                         debug a => _7;
+-                                         debug a => _13;
 +                                         debug a => const 64_u32;
                                       }
                                   }
@@ -59,37 +54,57 @@
       }
   
       bb0: {
+          StorageLive(_1);
           _1 = const 1_u8;
+          StorageLive(_2);
           _2 = const 2_u8;
+          StorageLive(_3);
           _3 = const 3_u8;
           StorageLive(_4);
-          _4 = const 6_u8;
           StorageLive(_5);
-          _5 = const "hello, world!";
-          StorageLive(_8);
-          StorageLive(_9);
-          StorageLive(_10);
-          _8 = const true;
-          _9 = const false;
-          _10 = const 123_u32;
           StorageLive(_6);
-          _6 = const Option::<u16>::Some(99_u16);
-          _11 = const 32_u32;
-          _12 = const 32_u32;
+          _6 = const 1_u8;
           StorageLive(_7);
-          _7 = const 64_u32;
+          _7 = const 2_u8;
+          _5 = const 3_u8;
           StorageDead(_7);
           StorageDead(_6);
+          StorageLive(_8);
+          _8 = const 3_u8;
+          _4 = const 6_u8;
           StorageDead(_8);
-          StorageDead(_9);
-          StorageDead(_10);
           StorageDead(_5);
+          StorageLive(_9);
+          _9 = const "hello, world!";
+          StorageLive(_10);
+          _10 = (const true, const false, const 123_u32);
+          StorageLive(_11);
+          _11 = Option::<u16>::Some(const 99_u16);
+          StorageLive(_12);
+          _12 = const Point {{ x: 32_u32, y: 32_u32 }};
+          StorageLive(_13);
+          StorageLive(_14);
+          _14 = const 32_u32;
+          StorageLive(_15);
+          _15 = const 32_u32;
+          _13 = const 64_u32;
+          StorageDead(_15);
+          StorageDead(_14);
+          _0 = const ();
+          StorageDead(_13);
+          StorageDead(_12);
+          StorageDead(_11);
+          StorageDead(_10);
+          StorageDead(_9);
           StorageDead(_4);
+          StorageDead(_3);
+          StorageDead(_2);
+          StorageDead(_1);
           return;
       }
   }
   
-  ALLOC0 (size: 4, align: 2) {
-      01 00 63 00                                     │ ..c.
+  ALLOC0 (size: 8, align: 4) {
+      20 00 00 00 20 00 00 00                         │  ... ...
   }
   
diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs
index d8ae08a0723..0e5ac4b8bd6 100644
--- a/tests/mir-opt/const_debuginfo.rs
+++ b/tests/mir-opt/const_debuginfo.rs
@@ -1,12 +1,23 @@
-// skip-filecheck
-// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
+// unit-test: ConstDebugInfo
+// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+ConstProp
 
 struct Point {
     x: u32,
     y: u32,
 }
 
+// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
 fn main() {
+    // CHECK-LABEL: fn main(
+    // CHECK: debug x => const 1_u8;
+    // CHECK: debug y => const 2_u8;
+    // CHECK: debug z => const 3_u8;
+    // CHECK: debug sum => const 6_u8;
+    // CHECK: debug s => const "hello, world!";
+    // CHECK: debug f => {{_.*}};
+    // CHECK: debug o => {{_.*}};
+    // CHECK: debug p => const Point
+    // CHECK: debug a => const 64_u32;
     let x = 1u8;
     let y = 2u8;
     let z = 3u8;
@@ -21,5 +32,3 @@ fn main() {
     let p = Point { x: 32, y: 32 };
     let a = p.x + p.y;
 }
-
-// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff