[llvm] [LV][VPlan] Add initial support for CSA vectorization (PR #121222)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 12:02:13 PST 2025


================
@@ -2894,6 +2929,134 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
   }
 };
 
+class VPConditionalScalarAssignmentHeaderPHIRecipe final
+    : public VPHeaderPHIRecipe {
+public:
+  VPConditionalScalarAssignmentHeaderPHIRecipe(PHINode *Phi,
+                                               VPValue &VPInitData)
+      : VPHeaderPHIRecipe(VPDef::VPConditionalScalarAssignmentHeaderPHISC, Phi,
+                          &VPInitData) {}
+
+  ~VPConditionalScalarAssignmentHeaderPHIRecipe() override = default;
+
+  VPConditionalScalarAssignmentHeaderPHIRecipe *clone() override {
+    return new VPConditionalScalarAssignmentHeaderPHIRecipe(
+        cast<PHINode>(getUnderlyingInstr()), *getOperand(0));
+  }
+
+  void execute(VPTransformState &State) override;
+
+  InstructionCost computeCost(ElementCount VF,
+                              VPCostContext &Ctx) const override;
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  /// Print the recipe.
+  void print(raw_ostream &O, const Twine &Indent,
+             VPSlotTracker &SlotTracker) const override;
+#endif
+
+  VP_CLASSOF_IMPL(VPDef::VPConditionalScalarAssignmentHeaderPHISC)
+
+  static inline bool classof(const VPHeaderPHIRecipe *R) {
+    return R->getVPDefID() == VPDef::VPConditionalScalarAssignmentHeaderPHISC;
+  }
+
+  VPValue *getVPInitData() { return getOperand(0); }
+
+  VPValue *NewData = nullptr;
----------------
artagnon wrote:

Would be nice to clearly separate member variables from member functions?

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


More information about the llvm-commits mailing list