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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sun May 3 15:42:02 PDT 2026


================
@@ -6766,6 +6766,15 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,
   assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
           (Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
          "Should not predicate a uniform recipe");
+  if (IsUniform && Instruction::isCast(VPI->getOpcode())) {
+    assert(!IsPredicated && "IsUniform implies unpredicated");
+    auto *CastR = cast<VPInstructionWithType>(VPI);
+    auto *Recipe = new VPInstructionWithType(
+        VPI->getOpcode(), VPI->operandsWithoutMask(), CastR->getResultType(),
+        *VPI, *VPI, VPI->getDebugLoc(), I->getName());
----------------
artagnon wrote:

Why are we replacing one VPInstructionWithType with an identical one? Am I missing something? It doesn't seem to be masked either? If it is, can we add casts to VPInstruction::alwaysUnmasked?

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


More information about the llvm-commits mailing list