diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2007-04-22 21:54:13 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2007-04-22 21:54:13 +0000 |
commit | a7f0d3ce228296d4b1b344162451f05c633e26f4 (patch) | |
tree | fd9c6eba95a9d0275c609f3f68420a87a22032e9 | |
parent | 007ce3b3367de8f961688ba170d1141b278e64aa (diff) | |
download | external_llvm-a7f0d3ce228296d4b1b344162451f05c633e26f4.tar.gz external_llvm-a7f0d3ce228296d4b1b344162451f05c633e26f4.tar.bz2 external_llvm-a7f0d3ce228296d4b1b344162451f05c633e26f4.zip |
Support alignment queries for degenerate (length 1) vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36352 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/TargetData.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 10ee707aea..2cbb903b96 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -493,9 +493,15 @@ unsigned char TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const { case Type::DoubleTyID: AlignType = FLOAT_ALIGN; break; - case Type::VectorTyID: - AlignType = VECTOR_ALIGN; + case Type::VectorTyID: { + const VectorType *VTy = cast<VectorType>(Ty); + // Degenerate vectors are assumed to be scalar-ized + if (VTy->getNumElements() == 1) + return getAlignment(VTy->getElementType(), abi_or_pref); + else + AlignType = VECTOR_ALIGN; break; + } default: assert(0 && "Bad type for getAlignment!!!"); break; |