[llvm] [AArch64] Increase fixed-length SVE scalarization costs (PR #226120)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 01:43:48 PDT 2026


================
@@ -4891,12 +4891,26 @@ InstructionCost AArch64TTIImpl::getScalarizationOverhead(
     TTI::VectorInstrContext VIC) const {
   if (isa<ScalableVectorType>(Ty))
     return InstructionCost::getInvalid();
-  if (Ty->getElementType()->isFloatingPointTy())
-    return BaseT::getScalarizationOverhead(Ty, DemandedElts, Insert, Extract,
-                                           CostKind);
-  unsigned VecInstCost =
-      CostKind == TTI::TCK_CodeSize ? 1 : ST->getVectorInsertExtractBaseCost();
-  return DemandedElts.popcount() * (Insert + Extract) * VecInstCost;
+
+  std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
+  if (!ST->useSVEForFixedLengthVectors(LT.second)) {
----------------
sdesmalen-arm wrote:

Please do this the opposite way around, i.e.

```
if (St->useSVEForFixedLengthVectors(..))
  return ...

<original code>
```

That makes the diff smaller and reduces indentation.

https://github.com/llvm/llvm-project/pull/226120


More information about the llvm-commits mailing list