[PATCH] D87679: [LV] Unroll factor is expected to be > 0

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 14:40:59 PDT 2020


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5598
   // If trip count is known or estimated compile time constant, limit the
   // interleave count to be less than the trip count divided by VF.
   if (BestKnownTC) {
----------------
My suggestion would be to (1) update the above comment: the interleave count is limited to be ** less** than the trip count divided by VF, **provided it is at-least 1**.

(2) place the `MaxInterleaveCount = std::max(1u, MaxInterleaveCount);` fix immediately after setting

```
    MaxInterleaveCount =
        std::min(*BestKnownTC / VF.getKnownMinValue(), MaxInterleaveCount);
```

and (3) introduce an `assert(MaxInterleaveCount > 0 && "Max Interleave Count must be at-least 1");` later -- setting it to 0 by targets should be treated as an error (thanks @kparzysz for the fix!)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87679



More information about the llvm-commits mailing list