[llvm] [VPlan] Add narrowToSingleScalarRecipe transform. (PR #139150)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 14:57:09 PDT 2025


================
@@ -1086,6 +1086,40 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
   }
 }
 
+static void convertToUniformRecipes(VPlan &Plan) {
+  if (Plan.hasScalarVFOnly())
+    return;
+
+  for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+           vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
+    for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
+      // Try to narrow wide and replicating recipes to uniform recipes, based on
+      // VPlan analysis.
+      auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
+      if (!RepR && !isa<VPWidenRecipe>(&R))
+        continue;
+      if (RepR && RepR->isUniform())
+        continue;
+
+      auto *RepOrWidenR = cast<VPSingleDefRecipe>(&R);
+      // Skip recipes that aren't uniform and don't have only their scalar
----------------
fhahn wrote:

Ah yes, was thinking about the recipes we process below, updated, thanks

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


More information about the llvm-commits mailing list