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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 05:16:29 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});
----------------
artagnon wrote:

Hm, not too happy with the operand 0 being the magic constant poison? Seems like the API could use some thought?

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


More information about the llvm-commits mailing list