[llvm] [VPlan] Narrow VPWidenCastRecipe to scalar cast recipe. (PR #166514)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 03:39:43 PST 2025


================
@@ -1419,6 +1423,15 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
           }))
         continue;
 
+      if (auto *CastR = dyn_cast<VPWidenCastRecipe>(RepOrWidenR)) {
+        VPBuilder Builder(CastR);
+        auto *Clone = Builder.createScalarCast(
+            CastR->getOpcode(), CastR->getOperand(0), CastR->getResultType(),
+            CastR->getDebugLoc());
+        CastR->replaceAllUsesWith(Clone);
+        CastR->eraseFromParent();
+        continue;
+      }
----------------
artagnon wrote:

I think vputils::getSingleScalarClone would be cleaner, but I'm happy to land this first. https://github.com/llvm/llvm-project/pull/161667.

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


More information about the llvm-commits mailing list