137
137
// /
138
138
// / KernelMemorySanitizer only supports X86_64 at the moment.
139
139
// /
140
+ //
141
+ // FIXME: This sanitizer does not yet handle scalable vectors
142
+ //
140
143
// ===----------------------------------------------------------------------===//
141
144
142
145
#include " llvm/Transforms/Instrumentation/MemorySanitizer.h"
@@ -1355,7 +1358,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
1355
1358
if (VectorType *VT = dyn_cast<VectorType>(OrigTy)) {
1356
1359
uint32_t EltSize = DL.getTypeSizeInBits (VT->getElementType ());
1357
1360
return FixedVectorType::get (IntegerType::get (*MS.C , EltSize),
1358
- VT ->getNumElements ());
1361
+ cast<FixedVectorType>(VT) ->getNumElements ());
1359
1362
}
1360
1363
if (ArrayType *AT = dyn_cast<ArrayType>(OrigTy)) {
1361
1364
return ArrayType::get (getShadowTy (AT->getElementType ()),
@@ -2077,7 +2080,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2077
2080
size_t VectorOrPrimitiveTypeSizeInBits (Type *Ty) {
2078
2081
assert (!(Ty->isVectorTy () && Ty->getScalarType ()->isPointerTy ()) &&
2079
2082
" Vector of pointers is not a valid shadow type" );
2080
- return Ty->isVectorTy () ? cast<VectorType >(Ty)->getNumElements () *
2083
+ return Ty->isVectorTy () ? cast<FixedVectorType >(Ty)->getNumElements () *
2081
2084
Ty->getScalarSizeInBits ()
2082
2085
: Ty->getPrimitiveSizeInBits ();
2083
2086
}
@@ -2095,8 +2098,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2095
2098
if (dstTy->isIntegerTy () && srcTy->isIntegerTy ())
2096
2099
return IRB.CreateIntCast (V, dstTy, Signed);
2097
2100
if (dstTy->isVectorTy () && srcTy->isVectorTy () &&
2098
- cast<VectorType >(dstTy)->getNumElements () ==
2099
- cast<VectorType >(srcTy)->getNumElements ())
2101
+ cast<FixedVectorType >(dstTy)->getNumElements () ==
2102
+ cast<FixedVectorType >(srcTy)->getNumElements ())
2100
2103
return IRB.CreateIntCast (V, dstTy, Signed);
2101
2104
Value *V1 = IRB.CreateBitCast (V, Type::getIntNTy (*MS.C , srcSizeInBits));
2102
2105
Value *V2 =
@@ -2141,7 +2144,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2141
2144
Constant *ShadowMul;
2142
2145
Type *Ty = ConstArg->getType ();
2143
2146
if (auto *VTy = dyn_cast<VectorType>(Ty)) {
2144
- unsigned NumElements = VTy->getNumElements ();
2147
+ unsigned NumElements = cast<FixedVectorType>( VTy) ->getNumElements ();
2145
2148
Type *EltTy = VTy->getElementType ();
2146
2149
SmallVector<Constant *, 16 > Elements;
2147
2150
for (unsigned Idx = 0 ; Idx < NumElements; ++Idx) {
@@ -2969,8 +2972,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2969
2972
2970
2973
Value *Acc = IRB.CreateExtractElement (
2971
2974
MaskedPassThruShadow, ConstantInt::get (IRB.getInt32Ty (), 0 ));
2972
- for (int i = 1 ,
2973
- N = cast<VectorType>(PassThru-> getType ()) ->getNumElements ();
2975
+ for (int i = 1 , N = cast<FixedVectorType>(PassThru-> getType ())
2976
+ ->getNumElements ();
2974
2977
i < N; ++i) {
2975
2978
Value *More = IRB.CreateExtractElement (
2976
2979
MaskedPassThruShadow, ConstantInt::get (IRB.getInt32Ty (), i));
@@ -3030,7 +3033,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3030
3033
IRBuilder<> IRB (&I);
3031
3034
Type *ShadowTy = getShadowTy (&I);
3032
3035
unsigned Width =
3033
- cast<VectorType >(I.getArgOperand (0 )->getType ())->getNumElements ();
3036
+ cast<FixedVectorType >(I.getArgOperand (0 )->getType ())->getNumElements ();
3034
3037
assert (isa<ConstantInt>(I.getArgOperand (2 )) &&
3035
3038
" pclmul 3rd operand must be a constant" );
3036
3039
unsigned Imm = cast<ConstantInt>(I.getArgOperand (2 ))->getZExtValue ();
0 commit comments