diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp index af67839c2d757..de2c0607d2edd 100644 --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -1416,8 +1416,9 @@ unsigned ARMTTIImpl::getGatherScatterOpCost(unsigned Opcode, Type *DataTy, unsigned VectorCost = NumElems * LT.first * ST->getMVEVectorCostFactor(); // The scalarization cost should be a lot higher. We use the number of vector // elements plus the scalarization overhead. - unsigned ScalarCost = - NumElems * LT.first + BaseT::getScalarizationOverhead(VTy, {}); + unsigned ScalarCost = NumElems * LT.first + + BaseT::getScalarizationOverhead(VTy, true, false) + + BaseT::getScalarizationOverhead(VTy, false, true); if (EltSize < 8 || Alignment < EltSize / 8) return ScalarCost;