[clang] [llvm] Global string alignment (PR #142346)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 18:38:17 PDT 2025


efriedma-quic wrote:

The clang patch was written the way it was because it was necessary to comply with the ABI rules.  Strings passed to printf don't have any sort of alignment requirement, so you can't really appeal to the ABI rules here, I think?

The problem with copying the alignment is that we don't really have any reason to believe the alignment of the original string is actually appropriate.

For the original patch, I think the comment was that the patch was equivalent to *deleting* the setAlignment() call.  And we really don't want to set the alignment that high; the current getPreferredAlign() prefer higher alignment.  Maybe `GV->setAlignment(M->getDataLayout().getPrefTypeAlign(getInt8Ty()));` would be okay, though.

https://github.com/llvm/llvm-project/pull/142346


More information about the llvm-commits mailing list