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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun May 3 14:09:07 PDT 2026


================
@@ -1031,8 +1031,15 @@ 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(Def))
----------------
fhahn wrote:

For some recipes we could infer single-scalar, but not for all I think, current analysis relies on VPReplicaeRecipe single scalar recipes to seed analysis. We can incremenatally continue to fold cases into VPInstruction(WithType), initially by tracking IsSingleScalar to fold VPWidenCastRecipe into VPInstructionWithType (https://github.com/llvm/llvm-project/pull/129712) and VPInstruction for single-scalar VPReplicateRecipe bin-ops (https://github.com/llvm/llvm-project/pull/141429)

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


More information about the llvm-commits mailing list