[llvm] [VPlan] Manage instruction medata in VPlan. (PR #135272)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 11:05:27 PDT 2025


================
@@ -1190,28 +1190,49 @@ struct VPIRPhi : public VPIRInstruction {
 #endif
 };
 
+using MDArrayRef = ArrayRef<std::pair<unsigned, MDNode *>>;
+
+/// Helper to manage IR metadata for recipes. It filters out metadata that
+/// cannot be proagated.
+class VPIRMetadata {
+  SmallVector<std::pair<unsigned, MDNode *>> Metadata;
+
+protected:
+  VPIRMetadata(MDArrayRef Metadata) : Metadata(Metadata) {}
+
+public:
+  /// Add all metadata to \p V if it is an instruction.
+  void applyMetadata(Value *V) const;
----------------
fhahn wrote:

turns out most places already check for instructions or have instructions. Updated to always pass as instruction, thanks!

setFlags already only accepts an instruction

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


More information about the llvm-commits mailing list