[llvm] [VPlan] - Generalize dead cycle removal in removeDeadRecipes. (PR #213632)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 04:14:34 PDT 2026


================
@@ -687,6 +687,32 @@ static void removeRedundantInductionCasts(VPlan &Plan) {
   }
 }
 
+/// If R is a phi-like recipe starting a dead cycle of recipes, erase all
+/// reachable recipes of the dead cycle.
+static void tryToRemoveDeadCycle(VPRecipeBase *R) {
+  auto *PhiR = dyn_cast<VPSingleDefRecipe>(R);
+  if (!PhiR || !isa<VPPhi, VPReductionPHIRecipe>(R))
----------------
fhahn wrote:

we could support un-truncated inductions here as well, truncated ones should also be fine, but would need materializing the truncate in the preheader. But does not need to be in the patch.

But please add a test case for the earlier crash (and the missed fold with untruncated IVs)

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


More information about the llvm-commits mailing list