[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:57:33 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();
----------------
artagnon wrote:

We can then guard it with isDeadRecipe as it is done for the replicate below?

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


More information about the llvm-commits mailing list