We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be00ea1 commit 919d413Copy full SHA for 919d413
tests/codegen-llvm/issues/cows-dont-have-branches-117763.rs
@@ -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