[llvm] [VPlan] Remove unused first mask op from VPBlendRecipe. (PR #87770)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 16:41:22 PDT 2024
================
@@ -1951,13 +1951,18 @@ class VPBlendRecipe : public VPSingleDefRecipe {
/// Return the number of incoming values, taking into account that a single
/// incoming value has no mask.
- unsigned getNumIncomingValues() const { return (getNumOperands() + 1) / 2; }
+ unsigned getNumIncomingValues() const { return (getNumOperands() + 2) / 2; }
/// Return incoming value number \p Idx.
- VPValue *getIncomingValue(unsigned Idx) const { return getOperand(Idx * 2); }
+ VPValue *getIncomingValue(unsigned Idx) const {
+ return Idx == 0 ? getOperand(0) : getOperand(Idx * 2 - 1);
+ }
/// Return mask number \p Idx.
- VPValue *getMask(unsigned Idx) const { return getOperand(Idx * 2 + 1); }
+ VPValue *getMask(unsigned Idx) const {
+ assert(Idx > 0);
----------------
ayalz wrote:
```suggestion
assert(Idx > 0 && "First index has no mask associated");
```
https://github.com/llvm/llvm-project/pull/87770
More information about the llvm-commits
mailing list