@@ -4376,6 +4376,22 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
43764376 setOriginForNaryOp (I);
43774377 }
43784378
4379+ [[maybe_unused]] static bool isFixedIntVectorTy (const Type *T) {
4380+ return isa<FixedVectorType>(T) && T->isIntOrIntVectorTy ();
4381+ }
4382+
4383+ [[maybe_unused]] static bool isFixedFPVectorTy (const Type *T) {
4384+ return isa<FixedVectorType>(T) && T->isFPOrFPVectorTy ();
4385+ }
4386+
4387+ [[maybe_unused]] static bool isFixedIntVector (const Value *V) {
4388+ return isFixedIntVectorTy (V->getType ());
4389+ }
4390+
4391+ [[maybe_unused]] static bool isFixedFPVector (const Value *V) {
4392+ return isFixedFPVectorTy (V->getType ());
4393+ }
4394+
43794395 // e.g., call <16 x i32> @llvm.x86.avx512.mask.cvtps2dq.512
43804396 // (<16 x float> a, <16 x i32> writethru, i16 mask,
43814397 // i32 rounding)
@@ -4393,11 +4409,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
43934409 Value *Mask = I.getOperand (2 );
43944410 [[maybe_unused]] Value *RoundingMode = I.getOperand (3 );
43954411
4396- assert (isa<FixedVectorType>(A->getType ()));
4397- assert (A->getType ()->isFPOrFPVectorTy ());
4398-
4399- assert (isa<FixedVectorType>(WriteThrough->getType ()));
4400- assert (WriteThrough->getType ()->isIntOrIntVectorTy ());
4412+ assert (isFixedFPVector (A));
4413+ assert (isFixedIntVector (WriteThrough));
44014414
44024415 unsigned ANumElements =
44034416 cast<FixedVectorType>(A->getType ())->getNumElements ();
@@ -4617,11 +4630,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
46174630 Value *WriteThrough = I.getOperand (1 );
46184631 Value *Mask = I.getOperand (2 );
46194632
4620- assert (isa<FixedVectorType>(A->getType ()));
4621- assert (A->getType ()->isIntOrIntVectorTy ());
4622-
4623- assert (isa<FixedVectorType>(WriteThrough->getType ()));
4624- assert (WriteThrough->getType ()->isIntOrIntVectorTy ());
4633+ assert (isFixedIntVector (A));
4634+ assert (isFixedIntVector (WriteThrough));
46254635
46264636 unsigned ANumElements =
46274637 cast<FixedVectorType>(A->getType ())->getNumElements ();
0 commit comments