[llvm] [LV][NFC] Refactor code for extracting first active element (PR #131118)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 00:47:37 PDT 2025


================
@@ -461,6 +461,11 @@ Value *VPInstruction::generate(VPTransformState &State) {
     Value *A = State.get(getOperand(0));
     return Builder.CreateNot(A, Name);
   }
+  case Instruction::ExtractElement: {
+    Value *Vec = State.get(getOperand(0));
+    Value *Idx = State.get(getOperand(1), true);
----------------
Mel-Chen wrote:

```suggestion
  case Instruction::ExtractElement: {
    assert(State.VF.isVector() && "Only extract elements from vectors");
    Value *Vec = State.get(getOperand(0));
    Value *Idx = State.get(getOperand(1), /*IsScalar*/ true);
```

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


More information about the llvm-commits mailing list