File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ // compile-flags: -O
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)
5+
6+ #![ crate_type = "lib" ]
7+ #![ feature( slice_from_ptr_range) ]
8+
9+ // This is intentionally using a non-power-of-two array length,
10+ // as that's where the optimization differences show up
11+
12+ // CHECK-LABEL: @flatten_via_ptr_range
13+ #[ no_mangle]
14+ pub fn flatten_via_ptr_range ( slice_of_arrays : & [ [ i32 ; 13 ] ] ) -> & [ i32 ] {
15+ // CHECK-NOT: lshr
16+ // CHECK-NOT: udiv
17+ // CHECK: mul nuw nsw i64 %{{.+}}, 13
18+ // CHECK-NOT: lshr
19+ // CHECK-NOT: udiv
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) }
23+ }
You can’t perform that action at this time.
0 commit comments