[llvm] [LV] Implement usesFirstLaneOnly for VPWidenCallRecipe (PR #196562)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 04:02:00 PDT 2026


================
@@ -1883,6 +1883,18 @@ InstructionCost VPWidenCallRecipe::computeCost(ElementCount VF,
                                   Ctx.CostKind);
 }
 
+bool VPWidenCallRecipe::usesFirstLaneOnly(const VPValue *Op) const {
+  assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
+  assert(Variant && "Variant not set");
+  FunctionType *VFTy = Variant->getFunctionType();
+  return all_of(enumerate(args()), [VFTy, &Op](const auto &Arg) {
+    auto [Idx, V] = Arg;
+    Type *ArgTy = VFTy->getParamType(Idx);
+    return V != Op || ArgTy->isIntegerTy() || ArgTy->isFloatingPointTy() ||
+           ArgTy->isPointerTy() || ArgTy->isByteTy();
----------------
huntergr-arm wrote:

Decided to fix the bug and add tests in a separate PR: #197417.

That will need to be replicated in #195518.

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


More information about the llvm-commits mailing list