[llvm] [Vectorize] Vectorization for __builtin_prefetch (PR #66160)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 19:21:32 PST 2023


================
@@ -4278,8 +4287,18 @@ bool LoopVectorizationCostModel::isScalarWithPredication(
   switch(I->getOpcode()) {
   default:
     return true;
-  case Instruction::Call:
-    return !VFDatabase::hasMaskedVariant(*(cast<CallInst>(I)), VF);
+  case Instruction::Call: {
+    if (!isa<PrefetchInst>(I))
+      return !VFDatabase::hasMaskedVariant(*(cast<CallInst>(I)), VF);
+    auto *Ptr = getPrefetchPointerOperand(I);
----------------
m-saito-fj wrote:

Thanks for the comment.

I think I can't implement it. This is because `HasMaskedVariant` checks if the library you are using has a masked and vectorized implementation. I don't think prefetch will ever be implemented in the library. This is because prefetch intrinsic is converted to a single instruction. Therefore, we did not consider using HasMaskedVariant.

https://github.com/llvm/llvm-project/pull/66160


More information about the llvm-commits mailing list