Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f0a68e

Browse files
committed
regression test for #117763
1 parent 6710835 commit 5f0a68e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ compile-flags: -Copt-level=3
2+
//@ needs-deterministic-layouts
3+
4+
// Currently Vec<T> and &[T] have layouts that start with (pointer, len)
5+
// which makes the conversion branchless.
6+
// A nice-to-have property, not guaranteed.
7+
#![crate_type = "cdylib"]
8+
9+
// CHECK-LABEL: @branchless_cow_slices
10+
#[no_mangle]
11+
pub fn branchless_cow_slices<'a>(cow: &'a std::borrow::Cow<'a, [u8]>) -> &'a [u8] {
12+
// CHECK-NOT: br
13+
// CHECK-NOT: select
14+
// CHECK-NOT: icmp
15+
// CHECK: ret { ptr, {{i32|i64}} }
16+
&*cow
17+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /