[llvm] [VPlan] Remove unused VPExpandSCEVRecipe before expansion (PR #181329)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 04:57:43 PST 2026


================
@@ -4952,6 +4952,10 @@ VPlanTransforms::expandSCEVs(VPlan &Plan, ScalarEvolution &SE) {
     auto *ExpSCEV = dyn_cast<VPExpandSCEVRecipe>(&R);
     if (!ExpSCEV)
       break;
+    if (ExpSCEV->getNumUsers() == 0) {
+      ExpSCEV->eraseFromParent();
+      continue;
+    }
----------------
fhahn wrote:

Is there a reason the VPExpandSCEV recipes are not cleaned up earlier, by `removeDeadRecipes`? Looks `VPExpandSCEVSC` is not handled `mayWriteToMemory` etc

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


More information about the llvm-commits mailing list