[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:

The onlyFirstLaneUsed case may require a single extract rather than full unpack.

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


More information about the llvm-commits mailing list