[llvm] [VPlan] Introduce vputils::getSingleScalarClone (PR #161667)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 02:20:33 PST 2025


================
@@ -208,19 +208,7 @@ static bool sinkScalarOperands(VPlan &Plan) {
     if (NeedsDuplicating) {
       if (ScalarVFOnly)
         continue;
-      VPSingleDefRecipe *Clone;
-      if (auto *SinkCandidateRepR =
-              dyn_cast<VPReplicateRecipe>(SinkCandidate)) {
-        // TODO: Handle converting to uniform recipes as separate transform,
-        // then cloning should be sufficient here.
-        Instruction *I = SinkCandidate->getUnderlyingInstr();
-        Clone = new VPReplicateRecipe(I, SinkCandidate->operands(), true,
-                                      nullptr /*Mask*/, *SinkCandidateRepR);
-        // TODO: add ".cloned" suffix to name of Clone's VPValue.
-      } else {
-        Clone = SinkCandidate->clone();
-      }
-
+      VPSingleDefRecipe *Clone = vputils::getSingleScalarClone(SinkCandidate);
----------------
artagnon wrote:

I investigated this some more, and it looks like VPScalarIVSteps can never satisfy vputils::isSingleScalar, and therefore, can never be narrowed by narrowToSingleScalar?

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


More information about the llvm-commits mailing list