@@ -4376,6 +4376,22 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4376
4376
setOriginForNaryOp (I);
4377
4377
}
4378
4378
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
+
4379
4395
// e.g., call <16 x i32> @llvm.x86.avx512.mask.cvtps2dq.512
4380
4396
// (<16 x float> a, <16 x i32> writethru, i16 mask,
4381
4397
// i32 rounding)
@@ -4393,11 +4409,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4393
4409
Value *Mask = I.getOperand (2 );
4394
4410
[[maybe_unused]] Value *RoundingMode = I.getOperand (3 );
4395
4411
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));
4401
4414
4402
4415
unsigned ANumElements =
4403
4416
cast<FixedVectorType>(A->getType ())->getNumElements ();
@@ -4617,11 +4630,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4617
4630
Value *WriteThrough = I.getOperand (1 );
4618
4631
Value *Mask = I.getOperand (2 );
4619
4632
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));
4625
4635
4626
4636
unsigned ANumElements =
4627
4637
cast<FixedVectorType>(A->getType ())->getNumElements ();
0 commit comments