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 919d413

Browse files
committed
regression test for #117763
1 parent be00ea1 commit 919d413

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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: ret { ptr, i64 }
14+
&*cow
15+
}

0 commit comments

Comments
(0)

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