[llvm] [VPlan] Use VPInstructionWithType for uniform casts. (PR #140623)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 07:06:40 PDT 2025


================
@@ -1048,8 +1048,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, {}, {});
----------------
lukel97 wrote:

Does this need to pass true for isSingleScalar?

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


More information about the llvm-commits mailing list