[llvm] c82e2f5 - [VPlan] Move VPPhiAccessors definition. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 13:24:23 PDT 2025


Author: Florian Hahn
Date: 2025-05-08T21:22:42+01:00
New Revision: c82e2f5c9ed08a270a1ec60bf7313af9c236ab98

URL: https://github.com/llvm/llvm-project/commit/c82e2f5c9ed08a270a1ec60bf7313af9c236ab98
DIFF: https://github.com/llvm/llvm-project/commit/c82e2f5c9ed08a270a1ec60bf7313af9c236ab98.diff

LOG: [VPlan] Move VPPhiAccessors definition. (NFC)

Move up definition to allow re-use by additional recipes.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 4068b02a97acc..e85d6ea9f5966 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1115,6 +1115,33 @@ class VPInstructionWithType : public VPInstruction {
 #endif
 };
 
+/// Helper type to provide functions to access incoming values and blocks for
+/// phi-like recipes.
+class VPPhiAccessors {
+protected:
+  /// Return a VPRecipeBase* to the current object.
+  virtual const VPRecipeBase *getAsRecipe() const = 0;
+
+public:
+  virtual ~VPPhiAccessors() = default;
+
+  /// Returns the incoming VPValue with index \p Idx.
+  VPValue *getIncomingValue(unsigned Idx) const {
+    return getAsRecipe()->getOperand(Idx);
+  }
+
+  /// Returns the incoming block with index \p Idx.
+  const VPBasicBlock *getIncomingBlock(unsigned Idx) const;
+
+  /// Returns the number of incoming values, also number of incoming blocks.
+  unsigned getNumIncoming() const { return getAsRecipe()->getNumOperands(); }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  /// Print the recipe.
+  void printPhiOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
+#endif
+};
+
 /// A recipe to wrap on original IR instruction not to be modified during
 /// execution, except for PHIs. PHIs are modeled via the VPIRPhi subclass.
 /// Expect PHIs, VPIRInstructions cannot have any operands.
@@ -1181,33 +1208,6 @@ class VPIRInstruction : public VPRecipeBase {
   void extractLastLaneOfFirstOperand(VPBuilder &Builder);
 };
 
-/// Helper type to provide functions to access incoming values and blocks for
-/// phi-like recipes.
-class VPPhiAccessors {
-protected:
-  /// Return a VPRecipeBase* to the current object.
-  virtual const VPRecipeBase *getAsRecipe() const = 0;
-
-public:
-  virtual ~VPPhiAccessors() = default;
-
-  /// Returns the incoming VPValue with index \p Idx.
-  VPValue *getIncomingValue(unsigned Idx) const {
-    return getAsRecipe()->getOperand(Idx);
-  }
-
-  /// Returns the incoming block with index \p Idx.
-  const VPBasicBlock *getIncomingBlock(unsigned Idx) const;
-
-  /// Returns the number of incoming values, also number of incoming blocks.
-  unsigned getNumIncoming() const { return getAsRecipe()->getNumOperands(); }
-
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-  /// Print the recipe.
-  void printPhiOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
-#endif
-};
-
 /// An overlay for VPIRInstructions wrapping PHI nodes enabling convenient use
 /// cast/dyn_cast/isa and execute() implementation. A single VPValue operand is
 /// allowed, and it is used to add a new incoming value for the single


        


More information about the llvm-commits mailing list