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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 19 11:59:33 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)) {
----------------
fhahn wrote:

Sure, I can do that, assuming you mean the checks below? Do you think there are any test cases that could hit the code, without your changes?

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


More information about the llvm-commits mailing list