[PATCH] D96773: [VPlan] Manage pairs of incoming (VPValue, VPBB) in VPWidenPHIRecipe.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 21 11:32:50 PST 2021


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4366-4367
 
     // The predecessor order is preserved and we can rely on mapping between
     // scalar and vector block predecessors.
+    for (unsigned i = 0; i < VPPhi->getNumOperands(); ++i) {
----------------
sguggill wrote:
> Please delete this now obsolete comment.
removed, thanks! I think the comment for `Builder.SetInsertPoint()` is not relevant any longer, so I removed that code as well.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:55-60
           NewRecipe = new VPWidenPHIRecipe(Phi);
-      } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
-        NewRecipe = new VPWidenGEPRecipe(
-            GEP, Plan->mapToVPValues(GEP->operands()), OrigLoop);
-      } else
-        NewRecipe =
-            new VPWidenRecipe(*Inst, Plan->mapToVPValues(Inst->operands()));
+          for (unsigned i = 0; i < VPPhi->getNumOperands(); ++i) {
+            VPValue *Inc = VPPhi->getIncomingValue(i);
+            VPBasicBlock *VPBB = VPPhi->getIncomingBlock(i);
+            cast<VPWidenPHIRecipe>(NewRecipe)->addIncoming(Inc, VPBB);
+          }
----------------
sguggill wrote:
> Do we need to create a new recipe here? Can we leave the original ingredient as is?
We can re-use the `VPWidenPHIRecipe`, updated!


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:76-83
+        else if (PHINode *Phi = dyn_cast<PHINode>(Inst)) {
+          InductionDescriptor II = Inductions.lookup(Phi);
+          if (II.getKind() == InductionDescriptor::IK_IntInduction ||
+              II.getKind() == InductionDescriptor::IK_FpInduction) {
+            VPValue *Start = Plan->getOrAddVPValue(II.getStartValue());
+            NewRecipe = new VPWidenIntOrFpInductionRecipe(Phi, Start, nullptr);
+          } else
----------------
sguggill wrote:
> Please delete.
Done, we should not have any VPValues with phis (and there's the assert).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96773/new/

https://reviews.llvm.org/D96773



More information about the llvm-commits mailing list