[PATCH] D130755: [LoopVectorize] Introduce trip count minimal value threshold to ignore tail-folding for scalable vectors

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 7 13:39:19 PDT 2022


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10119-10122
       SEL = CM_ScalarEpilogueNotAllowedLowTripLoop;
+      if (TTI->getMinTripCountTailFoldingThreshold() &&
+          ExpectedTC <= TTI->getMinTripCountTailFoldingThreshold())
+        return false;
----------------
dtemirbulatov wrote:
> paulwalker-arm wrote:
> > Can this be
> > ```
> > if (*ExpectedTC > TTI->getMinTripCountTailFoldingThreshold())
> >   SEL = CM_ScalarEpilogueNotAllowedLowTripLoop
> > ```
> > and still do what you need?
> I have to return false in order to prevent vectorization.
Thanks @dtemirbulatov. In which case it looks like you need to restructure the code a little so we emit the necessary remark and debug information.  e.g.
```
if (Hints.getForce() == LoopVectorizeHints::FK_Enabled)
...
else if (*ExpectedTC > TTI->getMinTripCountTailFoldingThreshold()) {
  LLVM_DEBUG(dbgs() << "\n");
  SEL = CM_ScalarEpilogueNotAllowedLowTripLoop;
} else {
  LLVM_DEBUG(dbgs() << " But the target considers the trip count too small to consider vectorizing.\n");
  reportVectorizationFailure(....);
  Hints.emitRemarkWithHints();
  return false;
}




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

https://reviews.llvm.org/D130755



More information about the llvm-commits mailing list