[llvm] [VPlan] Sink single-scalar replicates in licm (PR #187047)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 05:01:08 PDT 2026


================
@@ -2739,10 +2739,17 @@ static void licm(VPlan &Plan) {
       if (cannotHoistOrSinkRecipe(R))
         continue;
 
-      // TODO: Support sinking VPReplicateRecipe after ensuring replicateByVF
-      // handles sunk recipes correctly.
-      if (isa<VPReplicateRecipe>(&R))
-        continue;
+      if (auto *RepR = dyn_cast<VPReplicateRecipe>(&R)) {
+        assert(!RepR->isPredicated() &&
+               "Expected prior transformation of predicated replicates to "
+               "replicate regions");
+        // narrowToSingleScalarRecipes should have already maximally narrowed
+        // replicates to single-scalar replicates.
+        // TODO: When unrolling, replicatebyVF doesn't handle sunk
----------------
fhahn wrote:

```suggestion
        // TODO: When unrolling, replicateByVF doesn't handle sunk
```

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


More information about the llvm-commits mailing list