[llvm] [VPlan] Update VPInst::onlyFirstLaneUsed to check users. (PR #80269)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 03:00:21 PST 2024


================
@@ -515,6 +515,24 @@ void VPInstruction::execute(VPTransformState &State) {
     State.set(this, GeneratedValue, Part);
   }
 }
+bool VPInstruction::onlyFirstLaneUsed(const VPValue *Op) const {
+  assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
+  if (Instruction::isBinaryOp(getOpcode()))
+    return vputils::onlyFirstLaneUsed(this);
+
+  switch (getOpcode()) {
+  default:
+    return false;
+  case Instruction::ICmp:
+    return vputils::onlyFirstLaneUsed(this);
+  case VPInstruction::ActiveLaneMask:
+  case VPInstruction::CalculateTripCountMinusVF:
+  case VPInstruction::CanonicalIVIncrementForPart:
+  case VPInstruction::BranchOnCount:
+    return getOperand(0) == Op;
----------------
ayalz wrote:

This maintains current functionality, but leaves room for further improvement - to cover additional operands (of ActiveLaneMask, BranchOnCount) and opcodes (Not, Select, BranchOnCond) - worth a TODO.

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


More information about the llvm-commits mailing list