mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 17:33:24 +00:00
[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
This commit is contained in:
parent
6607716368
commit
59a65f7b24
@ -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();
|
||||
|
@ -512,3 +512,18 @@ declare <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %a, <8 x i16> %b) nounwind
|
||||
; CHECK-ORIGINS: call <8 x i16> @llvm.x86.sse2.padds.w
|
||||
; CHECK-ORIGINS: store i32 {{.*}} @__msan_retval_origin_tls
|
||||
; CHECK-ORIGINS: ret <8 x i16>
|
||||
|
||||
|
||||
; Test handling of vectors of pointers.
|
||||
; Check that shadow of such vector is a vector of integers.
|
||||
|
||||
define <8 x i8*> @VectorOfPointers(<8 x i8*>* %p) nounwind uwtable {
|
||||
%x = load <8 x i8*>* %p
|
||||
ret <8 x i8*> %x
|
||||
}
|
||||
|
||||
; CHECK: @VectorOfPointers
|
||||
; CHECK: load <8 x i64>*
|
||||
; CHECK: load <8 x i8*>*
|
||||
; CHECK: store <8 x i64> {{.*}} @__msan_retval_tls
|
||||
; CHECK: ret <8 x i8*>
|
||||
|
Loading…
Reference in New Issue
Block a user