[llvm] [LV][EVL] Support call instruction with EVL-vectorization (PR #110412)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 03:14:52 PST 2024


================
@@ -1484,6 +1484,19 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
                 VPValue *NewMask = GetNewMask(Red->getCondOp());
                 return new VPReductionEVLRecipe(*Red, EVL, NewMask);
               })
+              .Case<VPWidenIntrinsicRecipe>(
+                  [&](VPWidenIntrinsicRecipe *CInst) -> VPRecipeBase * {
+                    auto *CI = cast<CallInst>(CInst->getUnderlyingInstr());
+                    SmallVector<VPValue *> Ops(CInst->operands());
+                    Ops.push_back(&EVL);
+
+                    Intrinsic::ID VPID = VPIntrinsic::getForIntrinsic(
+                        CI->getCalledFunction()->getIntrinsicID());
+                    if (VPID == Intrinsic::not_intrinsic)
+                      return nullptr;
+                    return new VPWidenIntrinsicRecipe(
+                        *CI, VPID, Ops, CI->getType(), CI->getDebugLoc());
+                  })
----------------
Mel-Chen wrote:

Early break if the intrinsic can not be transformed it into vp intrinsic.
```suggestion
              .Case<VPWidenIntrinsicRecipe>(
                  [&](VPWidenIntrinsicRecipe *CInst) -> VPRecipeBase * {
                    auto *CI = cast<CallInst>(CInst->getUnderlyingInstr());
                    Intrinsic::ID VPID = VPIntrinsic::getForIntrinsic(
                        CI->getCalledFunction()->getIntrinsicID());
                    if (VPID == Intrinsic::not_intrinsic)
                      return nullptr;
                    SmallVector<VPValue *> Ops(CInst->operands());
                    Ops.push_back(&EVL);
                    return new VPWidenIntrinsicRecipe(
                        *CI, VPID, Ops, CI->getType(), CI->getDebugLoc());
                  })
```

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


More information about the llvm-commits mailing list