about summary refs log tree commit diff
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
commit2f5aa084c8bb6e1a4b014396a44087fd65a4c1c8 (patch)
treef8d3eef05908ca199750de62585a33a8de0876a8
parent7989568b8edd6531ed062614b71c327677b581ba (diff)
downloadrust-2f5aa084c8bb6e1a4b014396a44087fd65a4c1c8.tar.gz
rust-2f5aa084c8bb6e1a4b014396a44087fd65a4c1c8.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.
-rw-r--r--src/consts.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/consts.rs b/src/consts.rs
index c514b7a428b..474475f311f 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -364,6 +364,7 @@ pub fn const_alloc_to_gcc<'gcc>(
         llvals.push(cx.const_bytes(bytes));
     }
 
+    // FIXME(bjorn3) avoid wrapping in a struct when there is only a single element.
     cx.const_struct(&llvals, true)
 }