[llvm] [LV] Fix crash in epilog vectorization (PR #185480)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 06:24:25 PDT 2026


================
@@ -7373,8 +7373,10 @@ static void fixReductionScalarResumeWhenVectorizingEpilog(
           VPlanPatternMatch::m_Select(VPlanPatternMatch::m_VPValue(),
                                       VPlanPatternMatch::m_VPValue(BackedgeVal),
                                       VPlanPatternMatch::m_VPValue()));
-    EpiRedHeaderPhi = cast<VPReductionPHIRecipe>(
+    EpiRedHeaderPhi = cast_if_present<VPReductionPHIRecipe>(
         vputils::findRecipe(BackedgeVal, IsaPred<VPReductionPHIRecipe>));
+    if (!EpiRedHeaderPhi)
+      return;
----------------
fhahn wrote:

I am not sure this early exit is right, we found a reduction for which we need to update the resume value, which we don't do on this path

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


More information about the llvm-commits mailing list