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.
This commit is contained in:
bjorn3
2025-03-14 15:56:33 +00:00
parent f7b4354283
commit a5fa12b6b9
8 changed files with 26 additions and 25 deletions

View File

@@ -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)
}