[llvm] Reapply "[VPlan] Remove unused VPExpandSCEVRecipe before expansion" (PR #187233)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 02:19:26 PDT 2026


================
@@ -9236,8 +9181,10 @@ static SmallVector<Instruction *> preparePlanForEpilogueVectorLoop(
     auto *ExpandR = dyn_cast<VPExpandSCEVRecipe>(&R);
     if (!ExpandR)
       continue;
-    VPValue *ExpandedVal =
-        Plan.getOrAddLiveIn(ExpandedSCEVs.lookup(ExpandR->getSCEV()));
+    Value *ExpandedSCEV = ExpandedSCEVs.lookup(ExpandR->getSCEV());
+    if (!ExpandedSCEV)
+      continue;
----------------
Mel-Chen wrote:

I'm concerned this assertion might be not correct. Since different VFs can lead to different plans, the main plan and epilogue plan might diverge. Is it possible that a VPExpandSCEVRecipe ends up with no users in the main plan, but still has active users in the epilogue plan? This is something we need to examine carefully.

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


More information about the llvm-commits mailing list