summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetData.cpp
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-04-22 21:54:13 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-04-22 21:54:13 +0000
commit297fcb0f736f65f932af0ceea9d7f37f36efc794 (patch)
treec0764e43b7cfd588313f7875665896b5cab8c635 /llvm/lib/Target/TargetData.cpp
parent12effef41ef473b5b31e47d00f4102fe3d02d934 (diff)
downloadbcm5719-llvm-297fcb0f736f65f932af0ceea9d7f37f36efc794.tar.gz
bcm5719-llvm-297fcb0f736f65f932af0ceea9d7f37f36efc794.zip
Support alignment queries for degenerate (length 1) vectors.
llvm-svn: 36352
Diffstat (limited to 'llvm/lib/Target/TargetData.cpp')
-rw-r--r--llvm/lib/Target/TargetData.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp
index 10ee707aea4..2cbb903b963 100644
--- a/llvm/lib/Target/TargetData.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud