[clang] [clang] Increase alignment for large globals where in the same code object (x86) (PR #185487)

Marco Bartoli via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 05:40:37 PDT 2026


================
@@ -1832,6 +1832,7 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const {
         uint64_t TypeSize =
             !BaseT->isIncompleteType() ? getTypeSize(T.getTypePtr()) : 0;
         Align = std::max(Align, getMinGlobalAlignOfVar(TypeSize, VD));
+        Align = std::max(Align, getLargeGlobalPreferredAlign(TypeSize, Align));
----------------
wsxarcher wrote:

You were right, only explicit weak attributes were handles, I also now check the real linkage to be sure and it handles correctly inline, templates and static local as expected.

I changed the title

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


More information about the cfe-commits mailing list