[llvm] [LV] Keep duplicate recipes in VPExpressionRecipe (PR #156976)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 02:13:34 PDT 2025


================
@@ -3013,10 +3014,16 @@ class VPExpressionRecipe : public VPSingleDefRecipe {
                            {Ext0, Ext1, Mul, Red}) {}
 
   ~VPExpressionRecipe() override {
-    for (auto *R : reverse(ExpressionRecipes))
-      delete R;
-    for (VPValue *T : LiveInPlaceholders)
-      delete T;
+    SmallSet<VPSingleDefRecipe *, 4> ExpressionRecipesSeen;
+    for (auto *R : reverse(ExpressionRecipes)) {
+      if (ExpressionRecipesSeen.insert(R).second)
+        delete R;
+    }
+    SmallSet<VPValue *, 4> PlaceholdersSeen;
+    for (VPValue *T : LiveInPlaceholders) {
+      if (PlaceholdersSeen.insert(T).second)
----------------
sdesmalen-arm wrote:

There's no need to check for duplicates, there is a placeholder value for each operand, regardless of whether they're duplicate or not.

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


More information about the llvm-commits mailing list