[PATCH] D149081: [VPlan] Add VPWidenCastRecipe, split off from VPWidenRecipe (NFCI).

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 14:16:22 PDT 2023


Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.

LGTM, trying to keep all them recipes in order ... worth adding VPlan-print tests?



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8717
+  if (auto *CI = dyn_cast<CastInst>(Instr)) {
+    return toVPRecipeResult(
+        new VPWidenCastRecipe(CI->getOpcode(), Operands[0], CI->getType(), CI));
----------------
nit (Independent of this patch, mentioned before): VPRecipeOrVPValueTy should be cleaned up and removed.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:57-64
   case VPWidenIntOrFpInductionSC:
   case VPWidenCanonicalIVSC:
   case VPWidenPHISC:
   case VPBlendSC:
   case VPWidenSC:
+  case VPWidenCastSC:
   case VPWidenGEPSC:
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:91-98
   case VPWidenIntOrFpInductionSC:
   case VPWidenCanonicalIVSC:
   case VPWidenPHISC:
   case VPBlendSC:
   case VPWidenSC:
+  case VPWidenCastSC:
   case VPWidenGEPSC:
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:128-139
   case VPWidenIntOrFpInductionSC:
   case VPFirstOrderRecurrencePHISC:
   case VPWidenPointerInductionSC:
   case VPWidenCanonicalIVSC:
   case VPWidenPHISC:
   case VPBlendSC:
   case VPWidenSC:
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:706
+  /// Vectorize casts.
+  Type *DestTy = (State.VF.isScalar())
+                     ? getResultType()
----------------
Is this (or the original) Widen recipe built also for scalar VF? (Independent of this patch)


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:721
+                              VPSlotTracker &SlotTracker) const {
+  O << Indent << "WIDEN ";
+  printAsOperand(O, SlotTracker);
----------------
nit: worth printing WIDEN CAST? Differs from WIDEN by the "to" result type anyhow.

No current VPlan-printing tests are affected? Should be added?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanValue.h:348-351
     VPWidenGEPSC,
     VPWidenMemoryInstructionSC,
     VPWidenSC,
+    VPWidenCastSC,
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149081



More information about the llvm-commits mailing list