From 5663bb3f1c4637e36d6b6c3879b43e4f9e5bb347 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 30 Aug 2022 15:03:22 +0200 Subject: [PATCH] Add test for issue #85872 This has been fixed by the LLVM 15 upgrade, add a codegen test. Fixes #85872. --- .../codegen/issue-85872-multiple-reverse.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/codegen/issue-85872-multiple-reverse.rs diff --git a/src/test/codegen/issue-85872-multiple-reverse.rs b/src/test/codegen/issue-85872-multiple-reverse.rs new file mode 100644 index 0000000000000..591a1aca74747 --- /dev/null +++ b/src/test/codegen/issue-85872-multiple-reverse.rs @@ -0,0 +1,20 @@ +// min-llvm-version: 15.0.0 +// compile-flags: -O + +#![crate_type = "lib"] + +#[no_mangle] +pub fn u16_be_to_arch(mut data: [u8; 2]) -> [u8; 2] { + // CHECK-LABEL: @u16_be_to_arch + // CHECK: @llvm.bswap.i16 + data.reverse(); + data +} + +#[no_mangle] +pub fn u32_be_to_arch(mut data: [u8; 4]) -> [u8; 4] { + // CHECK-LABEL: @u32_be_to_arch + // CHECK: @llvm.bswap.i32 + data.reverse(); + data +}