2 // only-64bit (because we're using [ui]size)
3 // ignore-debug (because the assertions get in the way)
4 // min-llvm-version: 15.0 (because this is a relatively new instcombine)
7 #![feature(slice_from_ptr_range)]
9 // This is intentionally using a non-power-of-two array length,
10 // as that's where the optimization differences show up
12 // CHECK-LABEL: @flatten_via_ptr_range
14 pub fn flatten_via_ptr_range(slice_of_arrays: &[[i32; 13]]) -> &[i32] {
17 // CHECK: mul nuw nsw i64 %{{.+}}, 13
20 let r = slice_of_arrays.as_ptr_range();
21 let r = r.start.cast()..r.end.cast();
22 unsafe { core::slice::from_ptr_range(r) }