Skip to content

Commit 2f5aa08

Browse files
committed
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.
1 parent 7989568 commit 2f5aa08

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ pub fn const_alloc_to_gcc<'gcc>(
364364
llvals.push(cx.const_bytes(bytes));
365365
}
366366

367+
// FIXME(bjorn3) avoid wrapping in a struct when there is only a single element.
367368
cx.const_struct(&llvals, true)
368369
}
369370

0 commit comments

Comments
 (0)