@@ -2637,19 +2637,18 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
26372637 unsigned TotalNumElems = ParamType->getNumElements () * I.arg_size ();
26382638 FixedVectorType *ReinterpretShadowTy = nullptr ;
26392639 if (ReinterpretElemWidth.has_value ()) {
2640- assert (ParamType->getPrimitiveSizeInBits () %
2641- ReinterpretElemWidth.value () ==
2642- 0 );
2640+ assert (isAligned (Align (*ReinterpretElemWidth),
2641+ ParamType->getPrimitiveSizeInBits ()));
26432642 ReinterpretShadowTy = FixedVectorType::get (
2644- IRB.getIntNTy (ReinterpretElemWidth. value () ),
2645- ParamType->getPrimitiveSizeInBits () / ReinterpretElemWidth. value () );
2643+ IRB.getIntNTy (* ReinterpretElemWidth),
2644+ ParamType->getPrimitiveSizeInBits () / * ReinterpretElemWidth);
26462645 TotalNumElems = ReinterpretShadowTy->getNumElements () * I.arg_size ();
26472646 }
26482647
26492648 // Horizontal OR of shadow
26502649 SmallVector<int , 8 > EvenMask;
26512650 SmallVector<int , 8 > OddMask;
2652- for (unsigned X = 0 ; X + 1 < TotalNumElems; X += 2 ) {
2651+ for (unsigned X = 0 ; X < TotalNumElems - 1 ; X += 2 ) {
26532652 EvenMask.push_back (X);
26542653 OddMask.push_back (X + 1 );
26552654 }
@@ -2662,10 +2661,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
26622661 // number of elements is even, but we have never seen this in extant
26632662 // instruction sets, so we enforce that each parameter must have an even
26642663 // number of elements.
2665- assert (
2666- (cast<FixedVectorType>(FirstArgShadow->getType ())->getNumElements ()) %
2667- 2 ==
2668- 0 );
2664+ assert (isAligned (
2665+ Align (2 ),
2666+ cast<FixedVectorType>(FirstArgShadow->getType ())->getNumElements ()));
26692667
26702668 Value *EvenShadow;
26712669 Value *OddShadow;
@@ -2688,7 +2686,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
26882686 OrShadow = CreateShadowCast (IRB, OrShadow, getShadowTy (&I));
26892687
26902688 setShadow (&I, OrShadow);
2691-
26922689 setOriginForNaryOp (I);
26932690 }
26942691
0 commit comments