[llvm] [VPlan] Fix assertion when VPReductionPHIRecipe is simplified (PR #201023)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 02:22:06 PDT 2026


================
@@ -6392,8 +6392,9 @@ bool VPRecipeBuilder::replaceWithFinalIfReductionStore(
       // if tail folded.
       if (auto *Blend = VPlanPatternMatch::findUserOf<VPBlendRecipe>(Val))
         Val = Blend;
-      assert(VPlanPatternMatch::findUserOf<VPReductionPHIRecipe>(Val)
-                     ->getBackedgeValue() == Val &&
+      [[maybe_unused]] auto *Rdx =
+          VPlanPatternMatch::findUserOf<VPReductionPHIRecipe>(Val);
+      assert((!Rdx || Rdx->getBackedgeValue() == Val) &&
----------------
lukel97 wrote:

It's a live-in in the test case, but I'm not sure if that will always hold. E.g. I'm not sure if it might get simplified to something defined in the preheader.

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


More information about the llvm-commits mailing list