[llvm] [VPlan] Consistently use (Part, 0) for first lane scalar values (PR #80271)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 09:30:55 PST 2024


================
@@ -512,9 +513,19 @@ void VPInstruction::execute(VPTransformState &State) {
     if (!hasResult())
       continue;
     assert(GeneratedValue && "generateInstruction must produce a value");
-    State.set(this, GeneratedValue, Part);
+    if (GeneratedValue->getType()->isVectorTy()) {
+      State.set(this, GeneratedValue, Part);
----------------
ayalz wrote:

nit: can fold into a single
```suggestion
    bool isVector = GeneratedValue->getType()->isVectorTy();
    State.set(this, GeneratedValue, Part, !isVector);
    assert((isVector || getOpcode() == VPInstruction::ComputeReductionResult ||
                  State.VF.isScalar() || vputils::onlyFirstLaneUsed(this)) &&
             "scalar value but not only first lane used");
```

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


More information about the llvm-commits mailing list