From b611b6bbb81c67579429c41dc99f112a807b0a38 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 16 Jun 2024 01:22:58 -0700 Subject: Replace `NormalizeArrayLen` with `GVN` GVN is actually on in release, and covers all the same things (or more), with `LowerSliceLen` changed to produce `PtrMetadata`. --- ...ay_len.array_len_by_value.GVN.panic-unwind.diff | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/mir-opt/lower_array_len.array_len_by_value.GVN.panic-unwind.diff (limited to 'tests/mir-opt/lower_array_len.array_len_by_value.GVN.panic-unwind.diff') diff --git a/tests/mir-opt/lower_array_len.array_len_by_value.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_len_by_value.GVN.panic-unwind.diff new file mode 100644 index 00000000000..97fa503ac2e --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_len_by_value.GVN.panic-unwind.diff @@ -0,0 +1,26 @@ +- // MIR for `array_len_by_value` before GVN ++ // MIR for `array_len_by_value` after GVN + + fn array_len_by_value(_1: [u8; N]) -> usize { + debug arr => _1; + let mut _0: usize; + let mut _2: &[u8]; + let mut _3: &[u8; N]; + + bb0: { + StorageLive(_2); + StorageLive(_3); + _3 = &_1; + _2 = move _3 as &[u8] (PointerCoercion(Unsize)); + StorageDead(_3); +- _0 = PtrMetadata(move _2); ++ _0 = const N; + goto -> bb1; + } + + bb1: { + StorageDead(_2); + return; + } + } + -- cgit 1.4.1-3-g733a5