[llvm] [VPlan] Make simplifyRecipe more like InstCombine (PR #212968)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 04:13:01 PDT 2026


================
@@ -1659,7 +1618,16 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan) {
   for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
     for (VPRecipeBase &R : make_early_inc_range(*VPBB))
       if (auto *Def = dyn_cast<VPSingleDefRecipe>(&R))
-        simplifyRecipe(Def);
+        if (VPValue *New = simplifyRecipe(Def)) {
+          if (New != Def) {
+            // Replace the recipe with a new one.
+            Def->replaceAllUsesWith(New);
+            Def->eraseFromParent();
----------------
lukel97 wrote:

We simplify VPReplicateRecipe stores which have side effects. FWIW InstCombine also simplifies stores + calls through the same interface, i.e. it doesn't make any assumptions that the value being replaced is side effect free.

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


More information about the llvm-commits mailing list