[PATCH] D67572: [VectorUtils] Introduce the Vector Function Database (VFDatabase).

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 01:57:58 PST 2019


uabelho added a comment.

Hi,

Thanks for the reply!

Ok, I think I understand what is happening now at least.

We have a bunch of target intrinsics that we say are vectorizable, but we don't provide a name of the vector version of the intrinsic.

This meant that before this patch

  LoopVectorizationLegality::canVectorizeInstrs()

accepted to vectorize the loop since

  TLI->isFunctionVectorizable(CI->getCalledFunction()->getName())

returned true for the intrinsic.

Then in LoopVectorizationCostModel::getVectorCallCost we decided that the call to the intrinsic should be scalarized, since

  TLI->isFunctionVectorizable(FnName, VF)

returned false.

So the loop was vectorized, but we got VF calls to the scalar version of the intrinsic, just as we wanted.

However, with this patch, the check in

  LoopVectorizationLegality::canVectorizeInstrs()

now says false, since we do

  VFDatabase::getMappings(*CI).empty()

and we indeed get empty mappings since we don't provide any vector version.

So the presence of an intrinsic that we don't provide a vector version for prevents vectorization of the entire loop, even if it would we totally ok to do VF calls to the scalar version instead.

Is this change in behavior intended?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67572





More information about the llvm-commits mailing list