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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 04:27:23 PDT 2025


================
@@ -8453,6 +8453,21 @@ VPRecipeBuilder::handleReplication(Instruction *I, ArrayRef<VPValue *> Operands,
   assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
           (Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
          "Should not predicate a uniform recipe");
+  if (IsUniform && !IsPredicated) {
+    VPInstruction *VPI = nullptr;
+    if (Instruction::isCast(I->getOpcode())) {
+      VPI = new VPInstructionWithType(I->getOpcode(), Operands, I->getType(),
+                                      VPIRFlags(*I), I->getDebugLoc(),
+                                      I->getName());
+    } else if (Instruction::isBinaryOp(I->getOpcode())) {
+      VPI = new VPInstruction(I->getOpcode(), Operands, VPIRFlags(*I),
+                              I->getDebugLoc(), I->getName(), true);
+    }
----------------
ayalz wrote:

else - a uniform replicate recipe still takes care of all other cases?

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


More information about the llvm-commits mailing list