[llvm] [VPlan] Add VPInstruction to unpack vector values to scalars. (PR #155670)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 5 23:07:03 PDT 2025


================
@@ -3789,6 +3796,42 @@ void VPlanTransforms::materializeBuildVectors(VPlan &Plan) {
           });
     }
   }
+
+  // Create explicit VPInstructions to convert vectors to scalars.
+  for (VPBasicBlock *VPBB : VPBBsInsideLoopRegion) {
+    for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
+      if (isa<VPReplicateRecipe, VPInstruction, VPScalarIVStepsRecipe>(&R))
+        continue;
+      for (VPValue *Def : R.definedValues()) {
+        if (vputils::isSingleScalar(Def) || vputils::onlyFirstLaneUsed(Def))
----------------
ayalz wrote:

This is trying to identify all vector Def's, by excluding those that define a single scalar and those that define multiple scalars (replicate and scalar steps recipes). Better try to capture directly by some vputils? VPInstructions that define vectors are also excluded?

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


More information about the llvm-commits mailing list