diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -10,6 +10,8 @@ // Details of the algorithm: // https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm // +// FIXME: This sanitizer does not yet handle scalable vectors +// //===----------------------------------------------------------------------===// #include "llvm/Transforms/Instrumentation/AddressSanitizer.h" @@ -1504,8 +1506,8 @@ unsigned Granularity, uint32_t TypeSize, bool IsWrite, Value *SizeArgument, bool UseCalls, uint32_t Exp) { - auto *VTy = - cast(cast(Addr->getType())->getElementType()); + auto *VTy = cast( + cast(Addr->getType())->getElementType()); uint64_t ElemTypeSize = DL.getTypeStoreSizeInBits(VTy->getScalarType()); unsigned Num = VTy->getNumElements(); auto Zero = ConstantInt::get(IntptrTy, 0); diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -137,6 +137,9 @@ /// /// KernelMemorySanitizer only supports X86_64 at the moment. /// +// +// FIXME: This sanitizer does not yet handle scalable vectors +// //===----------------------------------------------------------------------===// #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" @@ -1355,7 +1358,7 @@ if (VectorType *VT = dyn_cast(OrigTy)) { uint32_t EltSize = DL.getTypeSizeInBits(VT->getElementType()); return FixedVectorType::get(IntegerType::get(*MS.C, EltSize), - VT->getNumElements()); + cast(VT)->getNumElements()); } if (ArrayType *AT = dyn_cast(OrigTy)) { return ArrayType::get(getShadowTy(AT->getElementType()), @@ -2077,7 +2080,7 @@ size_t VectorOrPrimitiveTypeSizeInBits(Type *Ty) { assert(!(Ty->isVectorTy() && Ty->getScalarType()->isPointerTy()) && "Vector of pointers is not a valid shadow type"); - return Ty->isVectorTy() ? cast(Ty)->getNumElements() * + return Ty->isVectorTy() ? cast(Ty)->getNumElements() * Ty->getScalarSizeInBits() : Ty->getPrimitiveSizeInBits(); } @@ -2095,8 +2098,8 @@ if (dstTy->isIntegerTy() && srcTy->isIntegerTy()) return IRB.CreateIntCast(V, dstTy, Signed); if (dstTy->isVectorTy() && srcTy->isVectorTy() && - cast(dstTy)->getNumElements() == - cast(srcTy)->getNumElements()) + cast(dstTy)->getNumElements() == + cast(srcTy)->getNumElements()) return IRB.CreateIntCast(V, dstTy, Signed); Value *V1 = IRB.CreateBitCast(V, Type::getIntNTy(*MS.C, srcSizeInBits)); Value *V2 = @@ -2141,7 +2144,7 @@ Constant *ShadowMul; Type *Ty = ConstArg->getType(); if (auto *VTy = dyn_cast(Ty)) { - unsigned NumElements = VTy->getNumElements(); + unsigned NumElements = cast(VTy)->getNumElements(); Type *EltTy = VTy->getElementType(); SmallVector Elements; for (unsigned Idx = 0; Idx < NumElements; ++Idx) { @@ -2969,8 +2972,8 @@ Value *Acc = IRB.CreateExtractElement( MaskedPassThruShadow, ConstantInt::get(IRB.getInt32Ty(), 0)); - for (int i = 1, - N = cast(PassThru->getType())->getNumElements(); + for (int i = 1, N = cast(PassThru->getType()) + ->getNumElements(); i < N; ++i) { Value *More = IRB.CreateExtractElement( MaskedPassThruShadow, ConstantInt::get(IRB.getInt32Ty(), i)); @@ -3030,7 +3033,7 @@ IRBuilder<> IRB(&I); Type *ShadowTy = getShadowTy(&I); unsigned Width = - cast(I.getArgOperand(0)->getType())->getNumElements(); + cast(I.getArgOperand(0)->getType())->getNumElements(); assert(isa(I.getArgOperand(2)) && "pclmul 3rd operand must be a constant"); unsigned Imm = cast(I.getArgOperand(2))->getZExtValue();