[PATCH] D104197: [VPlan] Track both incoming values for first-order recurrence phis.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 27 00:39:57 PDT 2021


Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.

This looks good to me, thanks!
Adding a couple of final nits.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4293
 
+  PHINode *Phi = cast<PHINode>(PhiR->getUnderlyingValue());
   // Fix the initial value of the original recurrence in the scalar loop.
----------------
Better place this definition of Phi after the following comment, right before it is needed for defining Start?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4752
 
-  VPValue *StartVPV = PhiR->getStartValue();
-  Value *StartV = StartVPV ? StartVPV->getLiveInIRValue() : nullptr;
+  bool IsOrdered = State.VF.isVector() &&
+                   Cost->isInLoopReduction(cast<PHINode>(PN)) &&
----------------
Better keep this definition of IsOrdered inside the `if (RdxDesc || Legal->isFirstOrderRecurrence(P)) {` below, right before it is used to define LastPartForNewPhi?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104197



More information about the llvm-commits mailing list