diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-11-09 21:43:20 -0800 | 
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-11-09 21:43:20 -0800 | 
| commit | cc7d8014d720ac800f868a0b7ec854f4a5036e3f (patch) | |
| tree | 8b08bdfe9c86dd3520b882d2616d9da9db3d4f65 /src/test/codegen/array-clone.rs | |
| parent | 8b09ba6a5d5c644fe0f1c27c7f9c80b334241707 (diff) | |
| download | rust-cc7d8014d720ac800f868a0b7ec854f4a5036e3f.tar.gz rust-cc7d8014d720ac800f868a0b7ec854f4a5036e3f.zip | |
Specialize array cloning for Copy types
Because after PR 86041, the optimizer no longer load-merges at the LLVM IR level, which might be part of the perf loss. (I'll run perf and see if this makes a difference.) Also I added a codegen test so this hopefully won't regress in future -- it passes on stable and with my change here, but not on the 2021-11-09 nightly.
Diffstat (limited to 'src/test/codegen/array-clone.rs')
| -rw-r--r-- | src/test/codegen/array-clone.rs | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/src/test/codegen/array-clone.rs b/src/test/codegen/array-clone.rs new file mode 100644 index 00000000000..0d42963bcd2 --- /dev/null +++ b/src/test/codegen/array-clone.rs @@ -0,0 +1,15 @@ +// compile-flags: -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @array_clone +#[no_mangle] +pub fn array_clone(a: &[u8; 2]) -> [u8; 2] { + // CHECK-NOT: getelementptr + // CHECK-NOT: load i8 + // CHECK-NOT: zext + // CHECK-NOT: shl + // CHECK: load i16 + // CHECK-NEXT: ret i16 + a.clone() +} | 
