@@ -2637,19 +2637,18 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2637
2637
unsigned TotalNumElems = ParamType->getNumElements () * I.arg_size ();
2638
2638
FixedVectorType *ReinterpretShadowTy = nullptr ;
2639
2639
if (ReinterpretElemWidth.has_value ()) {
2640
- assert (ParamType->getPrimitiveSizeInBits () %
2641
- ReinterpretElemWidth.value () ==
2642
- 0 );
2640
+ assert (isAligned (Align (*ReinterpretElemWidth),
2641
+ ParamType->getPrimitiveSizeInBits ()));
2643
2642
ReinterpretShadowTy = FixedVectorType::get (
2644
- IRB.getIntNTy (ReinterpretElemWidth. value () ),
2645
- ParamType->getPrimitiveSizeInBits () / ReinterpretElemWidth. value () );
2643
+ IRB.getIntNTy (* ReinterpretElemWidth),
2644
+ ParamType->getPrimitiveSizeInBits () / * ReinterpretElemWidth);
2646
2645
TotalNumElems = ReinterpretShadowTy->getNumElements () * I.arg_size ();
2647
2646
}
2648
2647
2649
2648
// Horizontal OR of shadow
2650
2649
SmallVector<int , 8 > EvenMask;
2651
2650
SmallVector<int , 8 > OddMask;
2652
- for (unsigned X = 0 ; X + 1 < TotalNumElems; X += 2 ) {
2651
+ for (unsigned X = 0 ; X < TotalNumElems - 1 ; X += 2 ) {
2653
2652
EvenMask.push_back (X);
2654
2653
OddMask.push_back (X + 1 );
2655
2654
}
@@ -2662,10 +2661,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2662
2661
// number of elements is even, but we have never seen this in extant
2663
2662
// instruction sets, so we enforce that each parameter must have an even
2664
2663
// 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 ()));
2669
2667
2670
2668
Value *EvenShadow;
2671
2669
Value *OddShadow;
@@ -2688,7 +2686,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2688
2686
OrShadow = CreateShadowCast (IRB, OrShadow, getShadowTy (&I));
2689
2687
2690
2688
setShadow (&I, OrShadow);
2691
-
2692
2689
setOriginForNaryOp (I);
2693
2690
}
2694
2691
0 commit comments