[PATCH] D113223: [VPlan] Add VPCanonicalIVRecipe, partly retire createInductionVariable.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 14:23:44 PST 2022


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

This looks fine, thanks!!
Clarifying a previous suggestion.



================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:728
+  case VPInstruction::InductionIncrementNUW: {
+    if (Part == 0) {
+      bool IsNUW = getOpcode() == VPInstruction::InductionIncrementNUW;
----------------
Ayal wrote:
> Ayal wrote:
> > early-break if Part != 0
> Ah, now it looks more logical to first handle Part 0; and possibly fuse the last State.set & break.
> Ah, now it looks more logical to first handle Part 0; and possibly fuse the last State.set & break.
Above thought was something like:


```
  case VPInstruction::CanonicalIVIncrement:
  case VPInstruction::CanonicalIVIncrementNUW: {
    Value *Next = nullptr;
    if (Part == 0) {
      bool IsNUW = getOpcode() == VPInstruction::CanonicalIVIncrementNUW;
      auto *Phi = State.get(getOperand(0), 0);
      // The loop step is equal to the vectorization factor (num of SIMD elements)
      // times the unroll factor (num of SIMD instructions).
      Value *Step = createStepForVF(Builder, Phi->getType(), State.VF, State.UF);
      Next = Builder.CreateAdd(Phi, Step, "index.next", IsNUW, false);
    } else
      Next = State.get(this, 0);

    State.set(this, Next, Part);
    break;
  }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113223



More information about the llvm-commits mailing list