[llvm] [VPlan] Handle live-in extend operands in partial reduction ::computeCost (PR #163175)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 08:32:43 PDT 2025


================
@@ -355,10 +357,10 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
     ExtAType = GetExtendKind(OpR);
   } else if (isa<VPReductionPHIRecipe>(OpR)) {
     auto RedPhiOp1R = getOperand(1)->getDefiningRecipe();
-    if (isa<VPWidenCastRecipe>(RedPhiOp1R)) {
+    if (isa_and_nonnull<VPWidenCastRecipe>(RedPhiOp1R)) {
       InputTypeA = Ctx.Types.inferScalarType(RedPhiOp1R->getOperand(0));
       ExtAType = GetExtendKind(RedPhiOp1R);
-    } else if (auto Widen = dyn_cast<VPWidenRecipe>(RedPhiOp1R))
+    } else if (auto Widen = dyn_cast_if_present<VPWidenRecipe>(RedPhiOp1R))
       HandleWiden(Widen);
   } else if (auto Widen = dyn_cast<VPWidenRecipe>(OpR)) {
----------------
SamTebbs33 wrote:

Would you mind making the same changes to the other `isa` checks and `dyn_cast` calls in this function? I've noticed they are still problematic with constants while working on partial reduction bundling.

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


More information about the llvm-commits mailing list