@@ -3570,8 +3570,11 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
35703570
35713571 InstructionCost Cost = 0 ;
35723572 if (IsMasked) {
3573- Cost +=
3574- Ctx.TTI .getMaskedMemoryOpCost (Opcode, Ty, Alignment, AS, Ctx.CostKind );
3573+ unsigned IID = isa<VPWidenLoadRecipe>(this ) ? Intrinsic::masked_load
3574+ : Intrinsic::masked_store;
3575+ const Value *Ptr = getLoadStorePointerOperand (&Ingredient);
3576+ Cost += Ctx.TTI .getMemIntrinsicInstrCost (
3577+ IID, Ty, Ptr, /* VariableMask*/ false , Alignment, Ctx.CostKind );
35753578 } else {
35763579 TTI::OperandValueInfo OpInfo = Ctx.getOperandInfo (
35773580 isa<VPWidenLoadRecipe, VPWidenLoadEVLRecipe>(this ) ? getOperand (0 )
@@ -3681,16 +3684,17 @@ InstructionCost VPWidenLoadEVLRecipe::computeCost(ElementCount VF,
36813684 if (!Consecutive || IsMasked)
36823685 return VPWidenMemoryRecipe::computeCost (VF, Ctx);
36833686
3684- // We need to use the getMaskedMemoryOpCost () instead of getMemoryOpCost()
3687+ // We need to use the getMemIntrinsicInstrCost () instead of getMemoryOpCost()
36853688 // here because the EVL recipes using EVL to replace the tail mask. But in the
36863689 // legacy model, it will always calculate the cost of mask.
3687- // TODO: Using getMemoryOpCost() instead of getMaskedMemoryOpCost when we
3690+ // TODO: Using getMemoryOpCost() instead of getMemIntrinsicInstrCost when we
36883691 // don't need to compare to the legacy cost model.
36893692 Type *Ty = toVectorTy (getLoadStoreType (&Ingredient), VF);
3690- unsigned AS = cast<PointerType>(Ctx.Types .inferScalarType (getAddr ()))
3691- ->getAddressSpace ();
3692- InstructionCost Cost = Ctx.TTI .getMaskedMemoryOpCost (
3693- Instruction::Load, Ty, Alignment, AS, Ctx.CostKind );
3693+ const Align Alignment = getLoadStoreAlignment (&Ingredient);
3694+ const Value *Ptr = getLoadStorePointerOperand (&Ingredient);
3695+ InstructionCost Cost = Ctx.TTI .getMemIntrinsicInstrCost (
3696+ Intrinsic::masked_load, Ty, Ptr, /* VariableMask*/ false , Alignment,
3697+ Ctx.CostKind );
36943698 if (!Reverse)
36953699 return Cost;
36963700
@@ -3790,16 +3794,17 @@ InstructionCost VPWidenStoreEVLRecipe::computeCost(ElementCount VF,
37903794 if (!Consecutive || IsMasked)
37913795 return VPWidenMemoryRecipe::computeCost (VF, Ctx);
37923796
3793- // We need to use the getMaskedMemoryOpCost () instead of getMemoryOpCost()
3797+ // We need to use the getMemIntrinsicInstrCost () instead of getMemoryOpCost()
37943798 // here because the EVL recipes using EVL to replace the tail mask. But in the
37953799 // legacy model, it will always calculate the cost of mask.
3796- // TODO: Using getMemoryOpCost() instead of getMaskedMemoryOpCost when we
3800+ // TODO: Using getMemoryOpCost() instead of getMemIntrinsicInstrCost when we
37973801 // don't need to compare to the legacy cost model.
37983802 Type *Ty = toVectorTy (getLoadStoreType (&Ingredient), VF);
3799- unsigned AS = cast<PointerType>(Ctx.Types .inferScalarType (getAddr ()))
3800- ->getAddressSpace ();
3801- InstructionCost Cost = Ctx.TTI .getMaskedMemoryOpCost (
3802- Instruction::Store, Ty, Alignment, AS, Ctx.CostKind );
3803+ const Align Alignment = getLoadStoreAlignment (&Ingredient);
3804+ const Value *Ptr = getLoadStorePointerOperand (&Ingredient);
3805+ InstructionCost Cost = Ctx.TTI .getMemIntrinsicInstrCost (
3806+ Intrinsic::masked_store, Ty, Ptr, /* VariableMask*/ false , Alignment,
3807+ Ctx.CostKind );
38033808 if (!Reverse)
38043809 return Cost;
38053810
0 commit comments