diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-25 16:04:38 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-25 16:04:38 +0000 |
commit | 59a65f7b24350cf483d777acfb403e9b8a31a771 (patch) | |
tree | 20ae3392c9fe65bd836aead371bd97a6c2c55a5e /lib/Transforms/Instrumentation/MemorySanitizer.cpp | |
parent | 6607716368ba04454ff9ad62ac25936357d67c51 (diff) |
[msan] Fix handling of vectors of pointers.
VectorType::getInteger() can not be used with them, because pointer size
depends on the target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171070 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/MemorySanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/MemorySanitizer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index ba16e3dc3f..41e250b7e7 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -541,8 +541,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { // This may return weird-sized types like i1. if (IntegerType *IT = dyn_cast<IntegerType>(OrigTy)) return IT; - if (VectorType *VT = dyn_cast<VectorType>(OrigTy)) - return VectorType::getInteger(VT); + if (VectorType *VT = dyn_cast<VectorType>(OrigTy)) { + uint32_t EltSize = MS.TD->getTypeStoreSizeInBits(VT->getElementType()); + return VectorType::get(IntegerType::get(*MS.C, EltSize), + VT->getNumElements()); + } if (StructType *ST = dyn_cast<StructType>(OrigTy)) { SmallVector<Type*, 4> Elements; for (unsigned i = 0, n = ST->getNumElements(); i < n; i++) @@ -1023,6 +1026,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { } size_t VectorOrPrimitiveTypeSizeInBits(Type *Ty) { + assert(!(Ty->isVectorTy() && Ty->getScalarType()->isPointerTy()) && + "Vector of pointers is not a valid shadow type"); return Ty->isVectorTy() ? Ty->getVectorNumElements() * Ty->getScalarSizeInBits() : Ty->getPrimitiveSizeInBits(); |