[llvm] Reapply "[LV] Use ExtractLane(LastActiveLane, V) live outs when tail-folding. (#149042)" (PR #168738)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 08:55:42 PST 2025


================
@@ -592,6 +590,8 @@ unsigned VPInstruction::getNumOperandsForOpcode(unsigned Opcode) {
   case Instruction::Switch:
   case VPInstruction::SLPLoad:
   case VPInstruction::SLPStore:
+  case VPInstruction::FirstActiveLane:
+  case VPInstruction::LastActiveLane:
----------------
lukel97 wrote:

I think with the test case added in #167897, this assertion:
```
assert((getNumOperandsForOpcode(Opcode) == -1u ||
          getNumOperandsForOpcode(Opcode) == getNumOperands()) &&
         "number of operands does not match opcode");
```

started firing on FirstActiveLane/LastActiveLane because we're now hitting the unrolling path with first order recurrences I think. These can have multiple operands so I think we need to return an unknown number of operands here.

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


More information about the llvm-commits mailing list