about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-30 17:50:09 +0100
committerGitHub <noreply@github.com>2023-01-30 17:50:09 +0100
commitdb9774951daab59074c81fb48a189a19cd80265a (patch)
tree320e0300371825a636906150a3f069459447cc4e /tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
parent4ac1796267c3af95cb97d630639d8938237586f6 (diff)
parentb456307cb10584f8ac48492500f0a1bca15d1adb (diff)
downloadrust-db9774951daab59074c81fb48a189a19cd80265a.tar.gz
rust-db9774951daab59074c81fb48a189a19cd80265a.zip
Rollup merge of #107172 - cjgillot:no-nal, r=nagisa
Reimplement NormalizeArrayLen based on SsaLocals

Based on https://github.com/rust-lang/rust/pull/106908
Fixes https://github.com/rust-lang/rust/issues/105929

Only the last commit "Reimplement NormalizeArrayLen" is relevant.
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff')
-rw-r--r--tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
new file mode 100644
index 00000000000..8b35fd57fa0
--- /dev/null
+++ b/tests/mir-opt/lower_array_len.array_len_raw.NormalizeArrayLen.diff
@@ -0,0 +1,50 @@
+- // MIR for `array_len_raw` before NormalizeArrayLen
++ // MIR for `array_len_raw` after NormalizeArrayLen
+  
+  fn array_len_raw(_1: [u8; N]) -> usize {
+      debug arr => _1;                     // in scope 0 at $DIR/lower_array_len.rs:+0:38: +0:41
+      let mut _0: usize;                   // return place in scope 0 at $DIR/lower_array_len.rs:+0:55: +0:60
+      let _2: &[u8];                       // in scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
+      let mut _3: &[u8; N];                // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+      let _4: &[u8; N];                    // in scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+      let mut _6: &[u8];                   // in scope 0 at $DIR/lower_array_len.rs:+3:5: +3:27
+      let _7: &[u8];                       // in scope 0 at $DIR/lower_array_len.rs:+3:14: +3:19
+      scope 1 {
+          debug arr => _2;                 // in scope 1 at $DIR/lower_array_len.rs:+1:9: +1:12
+          let _5: *const [u8];             // in scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
+          scope 2 {
+              debug arr => _5;             // in scope 2 at $DIR/lower_array_len.rs:+2:9: +2:12
+              scope 3 {
+              }
+          }
+      }
+  
+      bb0: {
+          StorageLive(_2);                 // scope 0 at $DIR/lower_array_len.rs:+1:9: +1:12
+          StorageLive(_3);                 // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+          StorageLive(_4);                 // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+          _4 = &_1;                        // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+          _3 = &(*_4);                     // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+          _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:+1:21: +1:25
+          StorageDead(_3);                 // scope 0 at $DIR/lower_array_len.rs:+1:24: +1:25
+          StorageDead(_4);                 // scope 0 at $DIR/lower_array_len.rs:+1:25: +1:26
+          StorageLive(_5);                 // scope 1 at $DIR/lower_array_len.rs:+2:9: +2:12
+          _5 = &raw const (*_2);           // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+          StorageLive(_6);                 // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
+          StorageLive(_7);                 // scope 2 at $DIR/lower_array_len.rs:+3:14: +3:19
+          _7 = &(*_5);                     // scope 3 at $DIR/lower_array_len.rs:+3:14: +3:19
+          _6 = &(*_7);                     // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
+-         _0 = Len((*_6));                 // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
++         _0 = const N;                    // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
+          goto -> bb1;                     // scope 2 at $DIR/lower_array_len.rs:+3:5: +3:27
+      }
+  
+      bb1: {
+          StorageDead(_6);                 // scope 2 at $DIR/lower_array_len.rs:+3:26: +3:27
+          StorageDead(_5);                 // scope 1 at $DIR/lower_array_len.rs:+4:1: +4:2
+          StorageDead(_2);                 // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2
+          StorageDead(_7);                 // scope 0 at $DIR/lower_array_len.rs:+4:1: +4:2
+          return;                          // scope 0 at $DIR/lower_array_len.rs:+4:2: +4:2
+      }
+  }
+