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

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 05:54:11 PST 2023


================
@@ -1563,6 +1563,15 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
       return thisT()->getGatherScatterOpCost(Instruction::Load, RetTy, Args[0],
                                              VarMask, Alignment, CostKind, I);
     }
+    case Intrinsic::masked_gather_prefetch: {
+      const Value *Mask = Args[4];
+      bool VarMask = !isa<Constant>(Mask);
+      Align Alignment = cast<ConstantInt>(Args[1])->getAlignValue();
----------------
m-saito-fj wrote:

I think it is guaranteed. Masked_gather_prefetch intrinsic is created only by `IRBuilder::CreateMaskedGatherPrefetch` function, and `Arg[1]` is create as `ConstantInt` in the function.
This is a pattern similar to masked_gather intrinsic, and `Arg[1]` is not checked in the masked_gather intrinsic case.

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


More information about the llvm-commits mailing list