@@ -2500,7 +2500,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2500
2500
}
2501
2501
}
2502
2502
2503
- // / Store the current combined values at the specified origin
2503
+ // / Store the current combined value at the specified origin
2504
2504
// / location.
2505
2505
void DoneAndStoreOrigin (TypeSize TS, Value *OriginPtr) {
2506
2506
if (MSV->MS .TrackOrigins ) {
@@ -3883,20 +3883,18 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3883
3883
void handleNEONVectorStoreIntrinsic (IntrinsicInst &I) {
3884
3884
IRBuilder<> IRB (&I);
3885
3885
3886
- I.dump ();
3887
-
3888
3886
// Don't use getNumOperands() because it includes the callee
3889
3887
int numArgOperands = I.arg_size ();
3890
3888
assert (numArgOperands >= 1 );
3891
3889
3892
3890
// The last arg operand is the output
3893
3891
Value *Addr = I.getArgOperand (numArgOperands - 1 );
3894
3892
assert (Addr->getType ()->isPointerTy ());
3895
- assert (isa<GetElementPtrInst>(Addr));
3896
3893
3897
3894
if (ClCheckAccessAddress)
3898
3895
insertShadowCheck (Addr, &I);
3899
3896
3897
+ // Every arg operand, other than the last one, is an input vector
3900
3898
IntrinsicInst *ShadowI = cast<IntrinsicInst>(I.clone ());
3901
3899
for (int i = 0 ; i < numArgOperands - 1 ; i++) {
3902
3900
assert (isa<FixedVectorType>(I.getArgOperand (i)->getType ()));
@@ -3906,77 +3904,31 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3906
3904
// MSan's GetShadowTy assumes the LHS is the type we want the shadow for
3907
3905
// e.g., for:
3908
3906
// [[TMP5:%.*]] = bitcast <16 x i8> [[TMP2]] to i128
3909
- // we know the type of the output (and shadow) is <16 x i8>.
3907
+ // we know the type of the output (and its shadow) is <16 x i8>.
3910
3908
//
3911
3909
// Arm NEON VST is unusual because the last argument is the output address:
3912
3910
// define void @st2_16b(<16 x i8> %A, <16 x i8> %B, ptr %P) {
3913
3911
// call void @llvm.aarch64.neon.st2.v16i8.p0
3914
3912
// (<16 x i8> [[A]], <16 x i8> [[B]], ptr [[P]])
3915
3913
// and we have no type information about P's operand. We must manually
3916
3914
// compute the type (<16 x i8> x 2).
3917
- errs () << " ###############\n " ;
3918
- Value *X = (cast<GetElementPtrInst>(Addr))->getPointerOperand ();
3919
- X->dump ();
3920
- errs () << " ###############\n " ;
3921
-
3922
- const DataLayout &DL = F.getDataLayout ();
3923
- uint16_t Width0 =
3924
- cast<FixedVectorType>(I.getArgOperand (0 )->getType ())->getNumElements ();
3925
- uint16_t ElemSize0 = cast<FixedVectorType>(I.getArgOperand (0 )->getType ())
3926
- ->getElementType ()
3927
- ->getPrimitiveSizeInBits ();
3928
- errs () << " Width0: " << Width0 << " , ElemSize0: " << ElemSize0 << " x " << (numArgOperands - 1 ) << " \n " ;
3929
- FixedVectorType* OutputVectorTy
3930
- = FixedVectorType::get (cast<FixedVectorType>(I.getArgOperand (0 )->getType ())
3931
- ->getElementType (),
3932
- cast<FixedVectorType>(I.getArgOperand (0 )->getType ())->getNumElements () * (numArgOperands - 1 ));
3933
- OutputVectorTy->dump ();
3934
-
3915
+ FixedVectorType *OutputVectorTy = FixedVectorType::get (
3916
+ cast<FixedVectorType>(I.getArgOperand (0 )->getType ())->getElementType (),
3917
+ cast<FixedVectorType>(I.getArgOperand (0 )->getType ())->getNumElements () *
3918
+ (numArgOperands - 1 ));
3935
3919
Type *ShadowTy = getShadowTy (OutputVectorTy);
3936
- errs () << " *** Shadow type is " << DL.getTypeSizeInBits (ShadowTy) << " bits\n " ;
3937
3920
Value *ShadowPtr, *OriginPtr;
3938
3921
std::tie (ShadowPtr, OriginPtr) = getShadowOriginPtr (
3939
3922
Addr, IRB, ShadowTy, Align (1 ), /* isStore*/ true );
3940
3923
ShadowI->setArgOperand (numArgOperands - 1 , ShadowPtr);
3941
3924
ShadowI->insertAfter (&I);
3942
- // setShadow(&I, ShadowI);
3943
-
3944
- ShadowPtr->dump ();
3945
- errs () << " Shadowptr: " << DL.getTypeSizeInBits (getShadowTy (ShadowPtr)) << " bits\n " ;
3946
- OriginPtr->dump ();
3947
- errs () << " Originptr: " << DL.getTypeSizeInBits (getShadowTy (OriginPtr)) << " bits\n " ;
3948
3925
3949
3926
if (MS.TrackOrigins ) {
3950
3927
OriginCombiner OC (this , IRB);
3951
3928
for (int i = 0 ; i < numArgOperands - 1 ; i++)
3952
3929
OC.Add (I.getArgOperand (i));
3953
- // Set origin for the destination, which is the last arg operand
3954
-
3955
- for (int i = 0 ; i < numArgOperands; i++) {
3956
- errs () << " Arg operand " << i << " \n " ;
3957
- I.getArgOperand (i)->dump ();
3958
-
3959
- if (isa<FixedVectorType>(I.getArgOperand (i)->getType ())) {
3960
- uint16_t Width =
3961
- cast<FixedVectorType>(I.getArgOperand (i)->getType ())->getNumElements ();
3962
- uint16_t ElemSize = cast<FixedVectorType>(I.getArgOperand (i)->getType ())
3963
- ->getElementType ()
3964
- ->getPrimitiveSizeInBits ();
3965
- errs () << " Width: " << Width << " elements; ElemSize: " << ElemSize << " bits each\n " ;
3966
- }
3967
-
3968
- errs () << " Type for i: " << DL.getTypeStoreSize (I.getArgOperand (i)->getType ()) << " \n " ;
3969
- if (I.getArgOperand (i)->getType ()->isPointerTy ()) {
3970
- errs () << " It's a pointer!\n " ;
3971
- if (isa<GetElementPtrInst>(I.getArgOperand (i))) {
3972
- errs () << " It's a GetElementPtrInst!\n " ;
3973
- errs () << " Pointer operand: " << DL.getTypeSizeInBits ((cast<GetElementPtrInst>(I.getArgOperand (i)))->getOperand (0 )->getType ()) << " bits\n " ;
3974
- }
3975
- }
3976
- errs () << " Type for shadow of i: " << DL.getTypeStoreSize (ShadowTy) << " BYTES\n " ;
3977
- errs () << " \n " ;
3978
- }
3979
3930
3931
+ const DataLayout &DL = F.getDataLayout ();
3980
3932
OC.DoneAndStoreOrigin (DL.getTypeStoreSize (OutputVectorTy), OriginPtr);
3981
3933
}
3982
3934
}
0 commit comments