[llvm] [VPlan] Free removeDeadRecipes from VPPhi simplification (PR #156438)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 2 03:48:40 PDT 2025
================
@@ -555,24 +555,9 @@ void VPlanTransforms::removeDeadRecipes(VPlan &Plan) {
vp_post_order_deep(Plan.getEntry()))) {
// The recipes in the block are processed in reverse order, to catch chains
// of dead recipes.
- for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
- if (isDeadRecipe(R)) {
+ for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB)))
+ if (isDeadRecipe(R))
R.eraseFromParent();
- continue;
- }
-
- // Check if R is a dead VPPhi <-> update cycle and remove it.
- auto *PhiR = dyn_cast<VPPhi>(&R);
- if (!PhiR || PhiR->getNumOperands() != 2 || PhiR->getNumUsers() != 1)
- continue;
- VPValue *Incoming = PhiR->getOperand(1);
- if (*PhiR->user_begin() != Incoming->getDefiningRecipe() ||
- Incoming->getNumUsers() != 1)
- continue;
- PhiR->replaceAllUsesWith(PhiR->getOperand(0));
- PhiR->eraseFromParent();
- Incoming->getDefiningRecipe()->eraseFromParent();
- }
----------------
lukel97 wrote:
I would have thought deleting VPPhis in removeDeadRecipes would have been a generally better place? Some transforms call `removeDeadRecipes` to cleanup and this means that there will still be some dead VPPhi cycles lying around until the next call to `simplifyRecipes`.
https://github.com/llvm/llvm-project/pull/156438
More information about the llvm-commits
mailing list