================
@@ -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));
----------------
efriedma-quic wrote:
I'm really not concerned about the OpenMP cases; we should already generate a
warning about misusing atomics like that.
In general, I'd prefer to do alignment optimizations on the IR level for two
reasons. One, we can use better heuristics at the IR level; we have more
information about how the global is used. For example, we could use PGO to
figure out if the global is accessed from hot code. Two, it's a lot easier to
check the conditions correctly at the LLVM IR level; your current version
doesn't handle inline variables correctly because it's checking the wrong kind
of "weak".
In any case, please fix the pull request's description so it's clear this is
only intended to increase the alignment of globals; the description makes it
sound like you're decreasing the alignment in some cases.
https://github.com/llvm/llvm-project/pull/185487
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits