[llvm] [VPlan] Use VPInstruction for uniform binops. (PR #141429)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 07:12:53 PDT 2025


================
@@ -1047,8 +1060,14 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
         unsigned ExtOpcode = match(R.getOperand(0), m_SExt(m_VPValue()))
                                  ? Instruction::SExt
                                  : Instruction::ZExt;
-        auto *VPC =
-            new VPWidenCastRecipe(Instruction::CastOps(ExtOpcode), A, TruncTy);
+        VPSingleDefRecipe *VPC;
+        if (vputils::isSingleScalar(R.getVPSingleValue()))
+          VPC = new VPInstructionWithType(Instruction::CastOps(ExtOpcode), {A},
+                                          TruncTy, {}, {});
+        else
+          VPC = new VPWidenCastRecipe(Instruction::CastOps(ExtOpcode), A,
----------------
fhahn wrote:

Yep, there's an earlier WIP patch to use VPInstructionWithType also for VPWidenCastRecipe (https://github.com/llvm/llvm-project/pull/129712), although I think it would probably make sense to re-visit this after support for uniform casts land.


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


More information about the llvm-commits mailing list