[PATCH] D107522: [PowerPC][AIX] attribute aligned cannot decrease align of a vector var.
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 04:43:25 PDT 2021
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4064-4068
if (Context.getTargetInfo().isTLSSupported()) {
unsigned MaxTLSAlign =
Context.toCharUnitsFromBits(Context.getTargetInfo().getMaxTLSAlign())
.getQuantity();
if (MaxTLSAlign && AlignVal > MaxTLSAlign && VD &&
----------------
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4076
+ // On AIX, an aligned attribute can not decrease the alignemnt when applied
+ // to a variable declaration with vector type.
----------------
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4081
+ if (Ty->isVectorType() && AlignVal < 16)
+ return;
+ }
----------------
This should produce a diagnostic rather than silently drop the attribute. I'd recommend `err_alignas_underaligned` if you're willing to make this an error. If not, you could add a new warning with the same wording.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107522/new/
https://reviews.llvm.org/D107522
More information about the llvm-commits
mailing list