diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -772,6 +772,13 @@ "Op must be an operand of the recipe"); return false; } + + /// Returns true if the recipe only uses scalars of operand \p Op. + virtual bool onlyScalarsUsed(const VPValue *Op) const { + assert(is_contained(operands(), Op) && + "Op must be an operand of the recipe"); + return onlyFirstLaneUsed(Op); + } }; inline bool VPUser::classof(const VPDef *Def) { @@ -1558,6 +1565,13 @@ "Op must be an operand of the recipe"); return isUniform(); } + + /// Returns true if the recipe only uses scalars of operand \p Op. + bool onlyScalarsUsed(const VPValue *Op) const override { + assert(is_contained(operands(), Op) && + "Op must be an operand of the recipe"); + return true; + } }; /// A recipe for generating conditional branches on the bits of a mask.