[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
Tue Apr 14 07:47:05 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:

Quick question on next steps: as we have validated this exact approach on the frontend in the Edge browser and are seeing tangible performance wins. Given that, are you open to merging this PR as-is, or is moving the optimization to the IR level a strict requirement?

If this approach is a strict no-go, I understand. In that case, could you point me to the most appropriate file or pass in the IR where this should live?

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


More information about the cfe-commits mailing list