[llvm] [VPlan] Use VPWidenIntrinsicRecipe to vp.select. (PR #110489)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 02:47:57 PDT 2024


================
@@ -1042,6 +1041,14 @@ StringRef VPWidenIntrinsicRecipe::getIntrinsicName() const {
   return Intrinsic::getBaseName(VectorIntrinsicID);
 }
 
+bool VPWidenIntrinsicRecipe::onlyFirstLaneUsed(const VPValue *Op) const {
+  assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
+  // Vector predication intrinsics only demand the the first lane the last
+  // operand (the EVL operand).
+  return VPIntrinsic::isVPIntrinsic(VectorIntrinsicID) &&
+         Op == getOperand(getNumOperands() - 1);
----------------
Mel-Chen wrote:

Meet an implementation divergence when rebasing #101641.
```
  return all_of(enumerate(operands()), [this, Op](const auto &I) {
    return Op != I.value() || 
           isVectorIntrinsicWithScalarOpAtArg(VectorIntrinsicID, I.index()) ||
           (VPIntrinsic::isVPIntrinsic(VectorIntrinsicID) && 
            I.index() == getNumOperands() - 1);
  });
```
Maybe we need to consider isVectorIntrinsicWithScalarOpAtArg?

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


More information about the llvm-commits mailing list