[llvm] [VPlan] Populate and use VPIRMetadata from VPInstructions (NFC) (PR #167253)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 02:26:26 PST 2025


================
@@ -1453,9 +1454,12 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
       : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, Flags, DL),
         VPIRMetadata(Metadata), Opcode(Opcode) {}
 
-  VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands)
-      : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, I), VPIRMetadata(I),
-        Opcode(I.getOpcode()) {}
+  VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands,
+                const VPIRMetadata &Metadata, DebugLoc DL)
+      : VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, VPIRFlags(I), DL),
----------------
david-arm wrote:

I think the two changes here are:

1. We're trying to avoid stashing the Instruction `I` in the VPValue that VPSingleDefRecipe derives from.
2. We want the metadata to come from the `Metadata` argument, rather than automatically from `I`.

Perhaps it's 2) that's most important, i.e. override the metadata on the instruction based on new information, i.e. runtime checks?

I do think that there are now a confusing number of different constructors for different classes. Perhaps worth adding a comment here @fhahn about why you're favouring one constructor over another to make it easier for the reader?

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


More information about the llvm-commits mailing list