@@ -2933,6 +2933,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2933
2933
// / Instrument intrinsics that look like a simple SIMD store: writes memory,
2934
2934
// / has 1 pointer argument and 1 vector argument, returns void.
2935
2935
bool handleVectorStoreIntrinsic (IntrinsicInst &I) {
2936
+ assert (I.arg_size () == 2 );
2937
+
2936
2938
IRBuilder<> IRB (&I);
2937
2939
Value *Addr = I.getArgOperand (0 );
2938
2940
Value *Shadow = getShadow (&I, 1 );
@@ -2958,6 +2960,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2958
2960
// / Instrument intrinsics that look like a simple SIMD load: reads memory,
2959
2961
// / has 1 pointer argument, returns a vector.
2960
2962
bool handleVectorLoadIntrinsic (IntrinsicInst &I) {
2963
+ assert (I.arg_size () == 1 );
2964
+
2961
2965
IRBuilder<> IRB (&I);
2962
2966
Value *Addr = I.getArgOperand (0 );
2963
2967
@@ -3497,6 +3501,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3497
3501
// The return type does not need to be the same type as the fields
3498
3502
// e.g., declare i32 @llvm.aarch64.neon.uaddv.i32.v16i8(<16 x i8>)
3499
3503
void handleVectorReduceIntrinsic (IntrinsicInst &I) {
3504
+ assert (I.arg_size () == 1 );
3505
+
3500
3506
IRBuilder<> IRB (&I);
3501
3507
Value *S = IRB.CreateOrReduce (getShadow (&I, 0 ));
3502
3508
S = CreateShadowCast (IRB, S, getShadowTy (&I));
@@ -3509,6 +3515,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3509
3515
// %a1)
3510
3516
// shadow = shadow[a0] | shadow[a1.0] | shadow[a1.1]
3511
3517
void handleVectorReduceWithStarterIntrinsic (IntrinsicInst &I) {
3518
+ assert (I.arg_size () == 2 );
3519
+
3512
3520
IRBuilder<> IRB (&I);
3513
3521
Value *Shadow0 = getShadow (&I, 0 );
3514
3522
Value *Shadow1 = IRB.CreateOrReduce (getShadow (&I, 1 ));
@@ -3521,6 +3529,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3521
3529
// Valid (non-poisoned) set bits in the operand pull low the
3522
3530
// corresponding shadow bits.
3523
3531
void handleVectorReduceOrIntrinsic (IntrinsicInst &I) {
3532
+ assert (I.arg_size () == 1 );
3533
+
3524
3534
IRBuilder<> IRB (&I);
3525
3535
Value *OperandShadow = getShadow (&I, 0 );
3526
3536
Value *OperandUnsetBits = IRB.CreateNot (I.getOperand (0 ));
@@ -3539,6 +3549,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3539
3549
// Valid (non-poisoned) unset bits in the operand pull down the
3540
3550
// corresponding shadow bits.
3541
3551
void handleVectorReduceAndIntrinsic (IntrinsicInst &I) {
3552
+ assert (I.arg_size () == 1 );
3553
+
3542
3554
IRBuilder<> IRB (&I);
3543
3555
Value *OperandShadow = getShadow (&I, 0 );
3544
3556
Value *OperandSetOrPoison = IRB.CreateOr (I.getOperand (0 ), OperandShadow);
@@ -3801,6 +3813,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3801
3813
// (and we) do not reduce AVX/AVX2 masked intrinsics into LLVM masked
3802
3814
// intrinsics.
3803
3815
void handleAVXMaskedStore (IntrinsicInst &I) {
3816
+ assert (I.arg_size () == 3 );
3817
+
3804
3818
IRBuilder<> IRB (&I);
3805
3819
3806
3820
Value *Dst = I.getArgOperand (0 );
@@ -3865,6 +3879,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3865
3879
// because we need to apply getShadowOriginPtr, not getShadow, to the first
3866
3880
// parameter.
3867
3881
void handleAVXMaskedLoad (IntrinsicInst &I) {
3882
+ assert (I.arg_size () == 2 );
3883
+
3868
3884
IRBuilder<> IRB (&I);
3869
3885
3870
3886
Value *Src = I.getArgOperand (0 );
@@ -4298,7 +4314,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4298
4314
}
4299
4315
4300
4316
// Approximation only
4317
+ //
4318
+ // e.g., <16 x i8> @llvm.aarch64.neon.pmull64(i64, i64)
4301
4319
void handleNEONVectorMultiplyIntrinsic (IntrinsicInst &I) {
4320
+ assert (I.arg_size () == 2 );
4321
+
4302
4322
handleShadowOr (I);
4303
4323
}
4304
4324
0 commit comments