[llvm] [VPlan] Implement VPWidenCastRecipe::computeCost(). (NFCI) (PR #111339)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 03:07:56 PDT 2024
================
@@ -1429,6 +1429,49 @@ void VPWidenCastRecipe::execute(VPTransformState &State) {
State.addMetadata(Cast, cast_or_null<Instruction>(getUnderlyingValue()));
}
+InstructionCost VPWidenCastRecipe::computeCost(ElementCount VF,
+ VPCostContext &Ctx) const {
+ auto *SrcTy = cast<VectorType>(
+ ToVectorTy(Ctx.Types.inferScalarType(getOperand(0)), VF));
+ auto *DestTy = cast<VectorType>(ToVectorTy(getResultType(), VF));
+ // Computes the CastContextHint from a VPWidenMemoryRecipe instruction.
+ auto ComputeCCH = [&](VPWidenMemoryRecipe *R) -> TTI::CastContextHint {
+ assert((isa<VPWidenLoadRecipe>(R) || isa<VPWidenStoreRecipe>(R)) &&
+ "Expected a load or a store!");
+
+ if (VF.isScalar())
----------------
fhahn wrote:
This seems to be missing handling of VPInterleaveRecipe and VPReplicateRecipe?
And returning normal for live ins (the !Loop->contains() case in the legacy cost model)
https://github.com/llvm/llvm-project/pull/111339
More information about the llvm-commits
mailing list