[llvm] [LV] Simplify the chain traversal in `getScaledReductions()` (NFCI) (PR #184830)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 04:14:17 PST 2026


================
@@ -6080,38 +6084,18 @@ getScaledReductions(VPReductionPHIRecipe *RedPhiR, VPValue *PrevValue,
   std::optional<TTI::PartialReductionExtendKind> OuterExtKind;
   if (match(Op, m_ZExtOrSExt(m_Mul(m_VPValue(), m_VPValue()))) ||
       match(Op, m_FPExt(m_FMul(m_VPValue(), m_VPValue())))) {
-    auto *CastRecipe = dyn_cast<VPWidenCastRecipe>(Op);
+    auto *CastRecipe = cast<VPWidenCastRecipe>(Op);
     if (!CastRecipe)
-      return false;
+      return std::nullopt;
     auto CastOp = static_cast<Instruction::CastOps>(CastRecipe->getOpcode());
     OuterExtKind = TTI::getPartialReductionExtendKind(CastOp);
     Op = CastRecipe->getOperand(0);
----------------
MacDue wrote:

Following https://github.com/llvm/llvm-project/pull/184830#discussion_r2895465527, the return value is now checked in `createPartialReductions()`. 

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


More information about the llvm-commits mailing list