[llvm] [VPlan] Introduce VPInstruction::InsertLastLane for start value of VPFirstOrderRecurrencePHIRecipe. (PR #171590)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 23:59:27 PST 2025


================
@@ -2246,6 +2256,15 @@ bool VPlanTransforms::adjustFixedOrderRecurrences(VPlan &Plan,
       RecurrencePhis.push_back(FOR);
 
   for (VPFirstOrderRecurrencePHIRecipe *FOR : RecurrencePhis) {
+    /// Adjust start value of fixed-order recurrence phi to [poison, ... ,
+    /// poison, start value].
+    VPValue *StartV = FOR->getStartValue();
+    VPValue *NewStart = PHBuilder.createNaryOp(
+        VPInstruction::InsertLastLane, {Plan.getOrAddLiveIn(PoisonValue::get(
+                                            TypeInfo.inferScalarType(StartV))),
+                                        StartV});
----------------
lukel97 wrote:

I don't see why we need to make it less generalized. I also think `InsertLastLane` is easier to understand than `InsertLastLaneIntoPoison`

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


More information about the llvm-commits mailing list