[llvm] [VPlan] Dissolve replicate regions with vector live-outs. (PR #189022)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 10:28:38 PDT 2026


================
@@ -3308,28 +3315,11 @@ static void scalarizeInstruction(const Instruction *Instr,
 }
 
 void VPReplicateRecipe::execute(VPTransformState &State) {
+  assert(!State.Lane && "replicate regions must be dissolved before ::execute");
   Instruction *UI = getUnderlyingInstr();
-
-  if (!State.Lane) {
-    assert(IsSingleScalar && "VPReplicateRecipes outside replicate regions "
-                             "must have already been unrolled");
-    scalarizeInstruction(UI, this, VPLane(0), State);
-    return;
-  }
-
-  assert((State.VF.isScalar() || !isSingleScalar()) &&
-         "uniform recipe shouldn't be predicated");
-  assert(!State.VF.isScalable() && "Can't scalarize a scalable vector");
-  scalarizeInstruction(UI, this, *State.Lane, State);
-  // Insert scalar instance packing it into a vector.
-  if (State.VF.isVector() && shouldPack()) {
-    Value *WideValue =
-        State.Lane->isFirstLane()
-            ? PoisonValue::get(toVectorizedTy(UI->getType(), State.VF))
-            : State.get(this);
-    State.set(this, State.packScalarIntoVectorizedValue(this, WideValue,
-                                                        *State.Lane));
-  }
+  assert(IsSingleScalar && "VPReplicateRecipes outside replicate regions "
+                           "must have already been unrolled");
----------------
ayalz wrote:

nit: the two asserts better be placed together, independent of setting UI
```suggestion
  assert(IsSingleScalar && "VPReplicateRecipes outside replicate regions "
                           "must have already been unrolled");
  Instruction *UI = getUnderlyingInstr();
```

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


More information about the llvm-commits mailing list