If no alignment is set, the abi/preferred alignment of structs will be
used which may be higher than required. This can lead to extra padding
and in the end an increase in data size.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/GlobalMerge.cpp | ||
---|---|---|
503 ↗ | (On Diff #149444) | The alignment of the output should be based on the alignment of the input globals, not the alignment of the type of the merged global. Looking more, we reject globals with an explicit alignment higher than the ABI alignment of the type. So I guess this is technically equivalent, but that isn't obvious; please add a comment. |
Comment Actions
Added a comment. I could change it to calculate the MaxAlignment from the alignment on the globals, if you think that's better in the long run.
Comment Actions
LGTM
Long-term this code should be rewritten to do alignment computations itself, and insert padding as needed, but this is fine for now.