diff options
author | Fraser Cormack <fraser@codeplay.com> | 2021-12-06 15:49:23 +0000 |
---|---|---|
committer | Fraser Cormack <fraser@codeplay.com> | 2022-01-03 12:32:46 +0000 |
commit | d76279404073e676a31f592d87a2f60306a00a12 (patch) | |
tree | 6297be392a415be582e2c9e05eb1148ce5331550 /llvm/lib/IR/Attributes.cpp | |
parent | cd7f621a0aa474d6953a50226aca38d35fcac895 (diff) | |
download | llvm-d76279404073e676a31f592d87a2f60306a00a12.zip llvm-d76279404073e676a31f592d87a2f60306a00a12.tar.gz llvm-d76279404073e676a31f592d87a2f60306a00a12.tar.bz2 |
[IR] Allow the 'align' param attr on vectors of pointers
This patch extends the available uses of the 'align' parameter attribute
to include vectors of pointers. The attribute specifies pointer
alignment element-wise.
This change was previously requested and discussed in D87304.
The vector predication (VP) intrinsics intend to use this for scatter
and gather operations, as they lack the explicit alignment parameter
that the masked versions use.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D115161
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index c899afa..2c917e4 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1839,12 +1839,12 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) { AttrBuilder Incompatible; if (!Ty->isIntegerTy()) - // Attribute that only apply to integers. + // Attributes that only apply to integers. Incompatible.addAttribute(Attribute::SExt) .addAttribute(Attribute::ZExt); if (!Ty->isPointerTy()) - // Attribute that only apply to pointers. + // Attributes that only apply to pointers. Incompatible.addAttribute(Attribute::Nest) .addAttribute(Attribute::NoAlias) .addAttribute(Attribute::NoCapture) @@ -1852,7 +1852,6 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) { .addAttribute(Attribute::ReadNone) .addAttribute(Attribute::ReadOnly) .addAttribute(Attribute::SwiftError) - .addAlignmentAttr(1) // the int here is ignored .addDereferenceableAttr(1) // the int here is ignored .addDereferenceableOrNullAttr(1) // the int here is ignored .addPreallocatedAttr(Ty) @@ -1862,6 +1861,10 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) { .addByRefAttr(Ty) .addTypeAttr(Attribute::ElementType, Ty); + if (!Ty->isPtrOrPtrVectorTy()) + // Attributes that only apply to pointers or vectors of pointers. + Incompatible.addAlignmentAttr(1); // the int here is ignored + // Some attributes can apply to all "values" but there are no `void` values. if (Ty->isVoidTy()) Incompatible.addAttribute(Attribute::NoUndef); |