[llvm] [VPlan] Add simple driver option to run some individual transforms. (PR #178522)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 10:27:13 PST 2026


================
@@ -1599,3 +1610,38 @@ bool VPlanTransforms::handleMultiUseReductions(VPlan &Plan) {
   }
   return true;
 }
+
+void VPlanTransforms::widenFromMetadata(VPlan &Plan,
+                                        const TargetLibraryInfo *TLI) {
+  unsigned VPlanWidenKind = Plan.getContext().getMDKindID("vplan.widen");
+  unsigned VPlanReplicateKind =
+      Plan.getContext().getMDKindID("vplan.replicate");
+  VPRegionBlock *VectorRegion = Plan.getVectorLoopRegion();
+
+  ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT(
+      VectorRegion);
+  for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
+    for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
+      auto *VPI = dyn_cast<VPInstruction>(&R);
+      if (!VPI)
+        continue;
+
+      VPRecipeBase *NewR = nullptr;
+      if (VPI->getMetadata(VPlanWidenKind)) {
+        NewR = new VPWidenRecipe(*VPI->getUnderlyingInstr(), VPI->operands(),
+                                 *VPI, *VPI, VPI->getDebugLoc());
----------------
artagnon wrote:

Curious what the plan for WidenCast and WidenGEP are?

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


More information about the llvm-commits mailing list