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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 01:50:59 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) &&
----------------
fhahn wrote:

can we assert that `Val` is a live-in if !Rdx? would also be good o update the assert message

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


More information about the llvm-commits mailing list