[PATCH] D47633: [GlobalMerge] Set the alignment on merged global structs

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 1 13:23:40 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/GlobalMerge.cpp:503
     const StructLayout *MergedLayout = DL.getStructLayout(MergedTy);
+    MergedGV->setAlignment(MergedLayout->getAlignment());
 
----------------
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.


https://reviews.llvm.org/D47633





More information about the llvm-commits mailing list