[PATCH] D91060: [LoopVectorizer] NFC: Remove unnecessary asserts that VF cannot be scalable.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 04:41:04 PST 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4896
                                                          ElementCount VF) {
-  assert(!VF.isScalable() && "scalable vectors not yet supported.");
   if (!blockNeedsPredication(I->getParent()))
----------------
dmgreen wrote:
> What happens if this function returns true? Do (predicated) scalars work OK for scalable vectors.
If this function returns true, the operation would have to be scalarized. For scalable vectors, scalarization is only supported if the value is uniform after vectorization, so it can extract the first or last element. Scalarizing a non-uniform value is not supported, because there is currently no way to expand to a scalarization loop (and even if there would be, we probably wouldn't want to).

>From the comment in `collectLoopUniforms` (above `addToWorklistIfAllowed`), it seems that when `isScalarWithPredication` returns true, the value cannot be uniform. This means that the cost-model/legalization should prevent this from happening for scalable vectors. This is one of the reasons we're adding a new cost class in D91174 so that it would never pick a scalable VF when scalarization is required.

There are currently other asserts that guard this case from happening, like in `VPReplicateRecipe::execute`.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91060



More information about the llvm-commits mailing list