[llvm] [VPlan] Consistently use (Part, 0) for first lane scalar values (PR #80271)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 18 06:12:47 PST 2024


================
@@ -883,8 +888,11 @@ void VPlan::execute(VPTransformState *State) {
 
     for (unsigned Part = 0; Part < LastPartForNewPhi; ++Part) {
       Value *Phi = State->get(PhiR, Part);
-      Value *Val = State->get(PhiR->getBackedgeValue(),
-                              SinglePartNeeded ? State->UF - 1 : Part);
+      Value *Val =
+          isa<VPCanonicalIVPHIRecipe>(PhiR)
+              ? State->get(PhiR->getBackedgeValue(), VPIteration(Part, 0))
+              : State->get(PhiR->getBackedgeValue(),
+                           SinglePartNeeded ? State->UF - 1 : Part);
----------------
ayalz wrote:

```suggestion
      unsigned PartNeeded = SinglePartNeeded ? State->UF - 1 : Part;
      Value *Val = State->get(PhiR->getBackedgeValue(), PartNeeded, IsScalarNeeded);
```
using API suggested below.

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


More information about the llvm-commits mailing list