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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 00:10:55 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());
----------------
lukel97 wrote:

I guess it's a bit strange but fine by me. Another idea could be to simplify a VPWidenSelectRecipe with a single-scalar condition to a VPInstruction select?

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


More information about the llvm-commits mailing list