[llvm] [AArch64] Tweak the cost-model of partial reductions to mitigate regressions from #181706 (PR #181707)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 08:27:25 PDT 2026


================
@@ -5958,22 +5958,26 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
   std::pair<InstructionCost, MVT> InputLT =
       getTypeLegalizationCost(InputVectorType);
 
-  InstructionCost Cost = InputLT.first * TTI::TCC_Basic;
+  // Returns cost of expanding the partial reduction in ISel.
+  auto GetExpandCost = [&]() -> InstructionCost {
+    unsigned ExtOpc = AccumVectorType->getElementType()->isFloatingPointTy()
+                          ? Instruction::FPExt
+                          : Instruction::ZExt;
----------------
sdesmalen-arm wrote:

For simplicitly I assumed that the cost of a zext/sext were equivalent. I've fixed that now to choose the opcode for the extend kind.

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


More information about the llvm-commits mailing list