about summary refs log tree commit diff
path: root/tests/codegen/const-array.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-03-14 15:56:33 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-03-28 09:19:57 +0000
commita5fa12b6b908894f59a788641c4b14839e556c5f (patch)
tree723c7409ef9e8d964dc492cb96ab533d585a7def /tests/codegen/const-array.rs
parentf7b43542838f0a4a6cfdb17fbeadf45002042a77 (diff)
downloadrust-a5fa12b6b908894f59a788641c4b14839e556c5f.tar.gz
rust-a5fa12b6b908894f59a788641c4b14839e556c5f.zip
Avoid wrapping constant allocations in packed structs when not necessary
This way LLVM will set the string merging flag if the alloc is a nul
terminated string, reducing binary sizes.
Diffstat (limited to 'tests/codegen/const-array.rs')
-rw-r--r--tests/codegen/const-array.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/codegen/const-array.rs b/tests/codegen/const-array.rs
index e257d8acc08..b3df76c3d8e 100644
--- a/tests/codegen/const-array.rs
+++ b/tests/codegen/const-array.rs
@@ -2,7 +2,7 @@
 
 #![crate_type = "lib"]
 
-const LUT: [u8; 2] = [1, 1];
+const LUT: [u8; 4] = [1, 1, 1, 1];
 
 // CHECK-LABEL: @decode
 #[no_mangle]
@@ -11,5 +11,5 @@ pub fn decode(i: u8) -> u8 {
     // CHECK-NEXT: icmp
     // CHECK-NEXT: select
     // CHECK-NEXT: ret
-    if i < 2 { LUT[i as usize] } else { 2 }
+    if i < 4 { LUT[i as usize] } else { 2 }
 }