[llvm] [VPlan] Handle single-scalar conds in VPWidenSelectRecipe. (PR #165506)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 00:29:44 PDT 2025


================
@@ -2022,6 +2023,11 @@ InstructionCost VPWidenSelectRecipe::computeCost(ElementCount VF,
       {TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None}, SI);
 }
 
+bool VPWidenSelectRecipe::onlyFirstLaneUsed(const VPValue *Op) const {
+  assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
+  return Op == getCond() && vputils::isSingleScalar(getCond());
----------------
ayalz wrote:

Better indicate separately if an operand accepts both a vector and a uniform scalar, when the recipe effectively broadcasts it implicitly in the latter case? As in `canBroadcast(Op)`. This applies to GEP operands and `select` conditions. In contrast, using only first lane applies to non-uniform consecutive operands, e.g., to base address of wide loads and stores.

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


More information about the llvm-commits mailing list