[llvm] [VPlan] Implement VPWidenCastRecipe::computeCost(). (NFCI) (PR #111339)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 00:23:51 PDT 2024
================
@@ -7258,12 +7258,29 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
const auto &ChainOps = RdxDesc.getReductionOpChain(RedPhi, OrigLoop);
SetVector<Instruction *> ChainOpsAndOperands(ChainOps.begin(),
ChainOps.end());
+ auto isZExtOrSExt = [](const unsigned Opcode) -> bool {
+ return Opcode == Instruction::ZExt || Opcode == Instruction::SExt;
+ };
// Also include the operands of instructions in the chain, as the cost-model
// may mark extends as free.
+ //
+ // For ARM, some of the instruction can folded into the reducion
+ // instruction. So we need to mark all folded instructions free.
+ // For example: We can fold reduce(mul(ext(A), ext(B))) into one
+ // instruction.
----------------
ElvisWang123 wrote:
@fhahn
Adding a new VPTransform to fold these ARM MVE instruction patterns into a reduction recipe (or a new recipe) might be an alternative method to remove these hard-coding checks in the cost model.
If the above solution looks good to you, I would like to migrate the VPlan-based pattern match from cost model to the VPlan transforms.
https://github.com/llvm/llvm-project/pull/111339
More information about the llvm-commits
mailing list