[llvm] [VPlan] Factor first-lane-scalar logic in VPI::execute (NFC) (PR #196207)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 03:18:32 PDT 2026


================
@@ -1568,20 +1563,18 @@ void VPInstruction::execute(VPTransformState &State) {
   assert(hasRequiredFlagsForOpcode(getOpcode()) &&
          "Opcode requires specific flags to be set");
   State.Builder.setFastMathFlags(getFastMathFlagsOrNone());
-  Value *GeneratedValue = generate(State);
+  bool GenerateScalar =
+      State.VF.isScalar() || (canGenerateScalarForFirstLane() &&
+                              (vputils::onlyFirstLaneUsed(this) ||
----------------
artagnon wrote:

We didn't touch any of the isSingleScalar opcodes?

```cpp
  case Instruction::Load:
  case Instruction::PHI:
  case VPInstruction::ExplicitVectorLength:
  case VPInstruction::ResumeForEpilogue:
  case VPInstruction::VScale:
    return true;
  default:
    return Instruction::isCast(getOpcode());
```

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


More information about the llvm-commits mailing list