[llvm] [VPlan] First step towards VPlan cost modeling. (PR #67934)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 13:02:43 PDT 2024
================
@@ -973,6 +973,93 @@ void VPWidenRecipe::execute(VPTransformState &State) {
#endif
}
+InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
+ VPCostContext &Ctx) {
+ VPWidenRecipe *Cur = this;
+ // Check if the recipe is used in a reduction chain. Let the legacy cost-model
+ // handle that case for now.
+ while (Cur->getNumUsers() == 1) {
+ if (auto *Next = dyn_cast<VPWidenRecipe>(*Cur->user_begin())) {
+ Cur = Next;
+ continue;
+ }
+ if (isa<VPReductionRecipe>(*Cur->user_begin()))
+ return InstructionCost::getInvalid();
+ break;
----------------
ayalz wrote:
```suggestion
VPUser *Next = *Cur->user_begin();
if (isa<VPReductionRecipe>(Next))
return InstructionCost::getInvalid();
if (!isa<VPWidenRecipe>(Next))
break;
Cur = cast<VPWidenRecipe>(Next);
```
https://github.com/llvm/llvm-project/pull/67934
More information about the llvm-commits
mailing list