[llvm] [AArch64][CostModel] Improve cost estimate of scalarizing a vector di… (PR #118055)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 00:05:01 PST 2024


================
@@ -11561,9 +11561,25 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
       unsigned OpIdx = isa<UnaryOperator>(VL0) ? 0 : 1;
       TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0));
       TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand(OpIdx));
-      return TTI->getArithmeticInstrCost(ShuffleOrOp, VecTy, CostKind, Op1Info,
-                                         Op2Info, {}, nullptr, TLI) +
-             CommonCost;
+      SmallVector<Value *, 16> Operands;
+      auto IsAllowedScalarTy = [](const Value *I) {
+        // Just to avoid regression with RISCV unittest.
+        return I->getType()->getPrimitiveSizeInBits() >= 32;
+      };
----------------
sushgokh wrote:

I have tried to debug the RISCV backend and looking at the comment
`// f16 with zvfhmin and bf16 will be promoted to f32.`, calculating the cast cost for the args seems a valid choice which isnt happening currently.

But if this is incorrect, could you please help me to avoid this regression?

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


More information about the llvm-commits mailing list