[llvm] [LV][EVL] Support cast instruction with EVL-vectorization (PR #108351)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 01:47:40 PST 2024


================
@@ -1484,6 +1484,24 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
                 VPValue *NewMask = GetNewMask(Red->getCondOp());
                 return new VPReductionEVLRecipe(*Red, EVL, NewMask);
               })
+              .Case<VPWidenCastRecipe>(
+                  [&](VPWidenCastRecipe *CInst) -> VPRecipeBase * {
+                    auto *CI = cast<CastInst>(CInst->getUnderlyingInstr());
+                    SmallVector<VPValue *> Ops(CInst->operands());
+                    Ops.push_back(&EVL);
+                    Intrinsic::ID VPID =
+                        VPIntrinsic::getForOpcode(CI->getOpcode());
+                    if (VPID == Intrinsic::not_intrinsic)
+                      return nullptr;
+                    // FIXME: In fact, can we really not pass the
+                    // underlyingInstr? In this case, how to set the Flag and
+                    // add metadata in VPWidenIntrinsicRecipe::execute?
+                    // return new VPWidenIntrinsicRecipe(
+                    //     *CI, VPID, Ops, CI->getType(), CI->getDebugLoc());
+                    return new VPWidenIntrinsicRecipe(
+                        VPID, Ops, TypeInfo.inferScalarType(CInst), false,
+                        false, false);
----------------
fhahn wrote:

Could you updated your branch to latest main? The constructor taking the memory effects as boolean flags has been removed in 8420dbf2b98edcaf966281912e7a2a4f7a2d6572 by @Mel-Chen 

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


More information about the llvm-commits mailing list