diff options
| author | khei4 <kk.asano.luxy@gmail.com> | 2023-08-21 19:35:08 +0900 |
|---|---|---|
| committer | khei4 <kk.asano.luxy@gmail.com> | 2023-08-26 18:14:47 +0900 |
| commit | d88c80f5de09d62a5c5d726274e3362a6c4f8ddd (patch) | |
| tree | f1fe1fb290b8c77e6788fe1b27d2abd7781ce70a | |
| parent | c40cfcf0494ff7506e753e750adb00eeea839f9c (diff) | |
| download | rust-d88c80f5de09d62a5c5d726274e3362a6c4f8ddd.tar.gz rust-d88c80f5de09d62a5c5d726274e3362a6c4f8ddd.zip | |
add codegen test for #107436
remove trailing whitespace, add trailing newline fix llvm version and function name
| -rw-r--r-- | tests/codegen/move-before-nocapture-ref-arg.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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>() +} |
