[llvm] [VPlan] Use VPInstructionWithType for uniform casts. (PR #140623)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 00:26:17 PDT 2026


================
@@ -1634,6 +1634,15 @@ void VPInstructionWithType::execute(VPTransformState &State) {
   }
 }
 
+InstructionCost VPInstructionWithType::computeCost(ElementCount VF,
+                                                   VPCostContext &Ctx) const {
+  // TODO: Compute cost for VPInstructions without underlying values.
+  if (!getUnderlyingValue())
+    return 0;
+  return getCostForRecipeWithOpcode(getOpcode(), ElementCount::getFixed(1),
----------------
david-arm wrote:

It would be good to have some cost model tests for the casts. I am happy to pull them out of https://github.com/llvm/llvm-project/pull/198291 into a NFC PR.

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


More information about the llvm-commits mailing list