@@ -22574,12 +22574,12 @@ static bool isMultipleOfN(const Value *V, const DataLayout &DL, unsigned N) {
2257422574/// removed by the caller
2257522575bool RISCVTargetLowering::lowerDeinterleavedIntrinsicToVPLoad(
2257622576 VPIntrinsic *Load, Value *Mask,
22577- ArrayRef<Value *> DeInterleaveResults ) const {
22577+ ArrayRef<Value *> DeinterleaveResults ) const {
2257822578 assert(Mask && "Expect a valid mask");
2257922579 assert(Load->getIntrinsicID() == Intrinsic::vp_load &&
2258022580 "Unexpected intrinsic");
2258122581
22582- const unsigned Factor = DeInterleaveResults .size();
22582+ const unsigned Factor = DeinterleaveResults .size();
2258322583
2258422584 auto *WideVTy = dyn_cast<ScalableVectorType>(Load->getType());
2258522585 // TODO: Support fixed vectors.
@@ -22592,10 +22592,9 @@ bool RISCVTargetLowering::lowerDeinterleavedIntrinsicToVPLoad(
2259222592 auto *VTy =
2259322593 VectorType::get(WideVTy->getScalarType(), WideNumElements / Factor,
2259422594 WideVTy->isScalableTy());
22595- // FIXME: Should pass alignment attribute from pointer, but vectorizer needs
22596- // to emit it first.
2259722595 auto &DL = Load->getModule()->getDataLayout();
22598- Align Alignment = Align(DL.getTypeStoreSize(WideVTy->getScalarType()));
22596+ Align Alignment = Load->getParamAlign(0).value_or(
22597+ DL.getABITypeAlign(WideVTy->getElementType()));
2259922598 if (!isLegalInterleavedAccessType(
2260022599 VTy, Factor, Alignment,
2260122600 Load->getArgOperand(0)->getType()->getPointerAddressSpace(), DL))
@@ -22629,20 +22628,18 @@ bool RISCVTargetLowering::lowerDeinterleavedIntrinsicToVPLoad(
2262922628 Factor);
2263022629
2263122630 Value *PoisonVal = PoisonValue::get(VecTupTy);
22632- SmallVector<Value *> Operands{PoisonVal, Load->getArgOperand(0)};
2263322631
2263422632 Function *VlsegNFunc = Intrinsic::getOrInsertDeclaration(
2263522633 Load->getModule(), IntrMaskIds[Factor - 2],
2263622634 {VecTupTy, Mask->getType(), EVL->getType()});
2263722635
22638- Operands.push_back(Mask);
22639-
22640- Operands.push_back(EVL);
22641-
22642- Operands.push_back(ConstantInt::get(XLenTy, RISCVII::TAIL_AGNOSTIC |
22643- RISCVII::MASK_AGNOSTIC));
22644-
22645- Operands.push_back(ConstantInt::get(XLenTy, Log2_64(SEW)));
22636+ Value *Operands[] = {
22637+ PoisonVal,
22638+ Load->getArgOperand(0),
22639+ Mask,
22640+ EVL,
22641+ ConstantInt::get(XLenTy, RISCVII::TAIL_AGNOSTIC | RISCVII::MASK_AGNOSTIC),
22642+ ConstantInt::get(XLenTy, Log2_64(SEW))};
2264622643
2264722644 CallInst *VlsegN = Builder.CreateCall(VlsegNFunc, Operands);
2264822645
@@ -22657,7 +22654,7 @@ bool RISCVTargetLowering::lowerDeinterleavedIntrinsicToVPLoad(
2265722654 Return = Builder.CreateInsertValue(Return, VecExtract, i);
2265822655 }
2265922656
22660- for (auto [Idx, DIO] : enumerate(DeInterleaveResults )) {
22657+ for (auto [Idx, DIO] : enumerate(DeinterleaveResults )) {
2266122658 // We have to create a brand new ExtractValue to replace each
2266222659 // of these old ExtractValue instructions.
2266322660 Value *NewEV =
@@ -22743,10 +22740,9 @@ bool RISCVTargetLowering::lowerInterleavedIntrinsicToVPStore(
2274322740 if (!VTy)
2274422741 return false;
2274522742
22746- // FIXME: Should pass alignment attribute from pointer, but vectorizer needs
22747- // to emit it first.
2274822743 const DataLayout &DL = Store->getDataLayout();
22749- Align Alignment = Align(DL.getTypeStoreSize(VTy->getScalarType()));
22744+ Align Alignment = Store->getParamAlign(1).value_or(
22745+ DL.getABITypeAlign(VTy->getElementType()));
2275022746 if (!isLegalInterleavedAccessType(
2275122747 VTy, Factor, Alignment,
2275222748 Store->getArgOperand(1)->getType()->getPointerAddressSpace(), DL))
0 commit comments