[llvm] [VPlan] Explicitly replicate VPInstructions by VF. (PR #155102)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 14:48:28 PDT 2025


================
@@ -501,11 +501,19 @@ cloneForLane(VPlan &Plan, VPBuilder &Builder, Type *IdxTy,
     NewOps.push_back(Ext);
   }
 
-  auto *New =
-      new VPReplicateRecipe(RepR->getUnderlyingInstr(), NewOps,
-                            /*IsSingleScalar=*/true, /*Mask=*/nullptr, *RepR);
-  New->transferFlags(*RepR);
-  New->insertBefore(RepR);
+  VPRecipeWithIRFlags *New;
+  if (auto *RepR = dyn_cast<VPReplicateRecipe>(DefR)) {
+    New =
+        new VPReplicateRecipe(RepR->getUnderlyingInstr(), NewOps,
+                              /*IsSingleScalar=*/true, /*Mask=*/nullptr, *RepR);
----------------
ayalz wrote:

TODO: have cloning of replicate recipes also provide the desired result coupled with setting its operands to NewOps (deriving IsSingleScalar and Mask from the operands?)

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


More information about the llvm-commits mailing list