diff options
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/cold-call-declare-and-call.rs | 13 | ||||
| -rw-r--r-- | tests/codegen/move-before-nocapture-ref-arg.rs | 22 | ||||
| -rw-r--r-- | tests/codegen/slice-as_chunks.rs | 6 | ||||
| -rw-r--r-- | tests/codegen/slice-iter-nonnull.rs | 6 |
4 files changed, 39 insertions, 8 deletions
diff --git a/tests/codegen/cold-call-declare-and-call.rs b/tests/codegen/cold-call-declare-and-call.rs index 71d49478bfc..572dc407f51 100644 --- a/tests/codegen/cold-call-declare-and-call.rs +++ b/tests/codegen/cold-call-declare-and-call.rs @@ -1,12 +1,21 @@ +// revisions: NORMAL WINDOWS // compile-flags: -C no-prepopulate-passes +//[NORMAL] ignore-windows +//[WINDOWS] only-windows +//[WINDOWS] only-x86_64 #![crate_type = "lib"] #![feature(rust_cold_cc)] // wasm marks the definition as `dso_local`, so allow that as optional. -// CHECK: define{{( dso_local)?}} coldcc void @this_should_never_happen(i16 -// CHECK: call coldcc void @this_should_never_happen(i16 +// NORMAL: define{{( dso_local)?}} preserve_mostcc void @this_should_never_happen(i16 +// NORMAL: call preserve_mostcc void @this_should_never_happen(i16 + +// See the comment in `Target::adjust_abi` for why this differs + +// WINDOWS: define void @this_should_never_happen(i16 +// WINDOWS: call void @this_should_never_happen(i16 #[no_mangle] pub extern "rust-cold" fn this_should_never_happen(x: u16) {} diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs new file mode 100644 index 00000000000..c7b400c8f8d --- /dev/null +++ b/tests/codegen/move-before-nocapture-ref-arg.rs @@ -0,0 +1,22 @@ +// Verify that move before the call of the function with noalias, nocapture, readonly. +// #107436 +// compile-flags: -O +// min-llvm-version: 17 + +#![crate_type = "lib"] + +#[repr(C)] +pub struct ThreeSlices<'a>(&'a [u32], &'a [u32], &'a [u32]); + +#[no_mangle] +pub fn sum_slices(val: ThreeSlices) -> u32 { + // CHECK-NOT: memcpy + let val = val; + sum(&val) +} + +#[no_mangle] +#[inline(never)] +pub fn sum(val: &ThreeSlices) -> u32 { + val.0.iter().sum::<u32>() + val.1.iter().sum::<u32>() + val.2.iter().sum::<u32>() +} diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs index 48e3f73fc86..efac9f3d68d 100644 --- a/tests/codegen/slice-as_chunks.rs +++ b/tests/codegen/slice-as_chunks.rs @@ -22,9 +22,9 @@ pub fn chunks4(x: &[u8]) -> &[[u8; 4]] { // CHECK-LABEL: @chunks4_with_remainder #[no_mangle] pub fn chunks4_with_remainder(x: &[u8]) -> (&[[u8; 4]], &[u8]) { - // CHECK: and i64 %x.1, -4 - // CHECK: and i64 %x.1, 3 - // CHECK: lshr exact + // CHECK-DAG: and i64 %x.1, -4 + // CHECK-DAG: and i64 %x.1, 3 + // CHECK-DAG: lshr // CHECK-NOT: mul // CHECK-NOT: udiv // CHECK-NOT: urem diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs index f7d164bc856..8749226d401 100644 --- a/tests/codegen/slice-iter-nonnull.rs +++ b/tests/codegen/slice-iter-nonnull.rs @@ -100,13 +100,13 @@ pub fn slice_iter_is_empty(it: &std::slice::Iter<'_, u32>) -> bool { // CHECK-LABEL: @slice_iter_len #[no_mangle] pub fn slice_iter_len(it: &std::slice::Iter<'_, u32>) -> usize { - // CHECK: %[[START:.+]] = load ptr, ptr %it, - // CHECK-SAME: !nonnull - // CHECK-SAME: !noundef // CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1 // CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]] // CHECK-SAME: !nonnull // CHECK-SAME: !noundef + // CHECK: %[[START:.+]] = load ptr, ptr %it, + // CHECK-SAME: !nonnull + // CHECK-SAME: !noundef // CHECK: ptrtoint // CHECK: ptrtoint |
