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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 13:05:09 PDT 2026


================
@@ -1883,6 +1883,16 @@ 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;
+    return V != Op || !VFTy->getParamType(Idx)->isVectorTy();
----------------
fhahn wrote:

could we check for scalar types here? Thinking about other non-vector types that may require special handling, like struct types with vector element types

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


More information about the llvm-commits mailing list