[PATCH] D120827: [VPlan] Helper to check if a recipe only uses scalar values of op.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 9 04:10:55 PST 2022
fhahn updated this revision to Diff 414061.
fhahn added a comment.
In D120827#3367168 <https://reviews.llvm.org/D120827#3367168>, @Ayal wrote:
> How about VPScalarIVStepsRecipe, VPBlendRecipe, VPBranchOnMaskRecipe, VPPredInstPHIRecipe, VPExpandSCEVRecipe?
I updated the patch to also support VPScalarIVStepsRecipe, VPPredInstPHIRecipe & VPExpandSCEVRecipe.
> Is it worth distinguishing between recipes that can immediately tell they only use scalars (or only use first scalar lane) such as VPRepilcateRecipe - and those that don't care and need to check if all their users are of the former type, such as VPBlendRecipe and possibly VPPredInstPHIRecipe?
I am not sure if we need that at the moment, but it might be useful to have in the future if compile-time comes a concern for some analysis?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120827/new/
https://reviews.llvm.org/D120827
Files:
llvm/lib/Transforms/Vectorize/VPlan.h
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ 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.
@@ -1626,6 +1640,13 @@
void print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override;
#endif
+
+ /// 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 widening load/store operations.
@@ -1754,6 +1775,13 @@
void print(raw_ostream &O, const Twine &Indent,
VPSlotTracker &SlotTracker) const override;
#endif
+
+ /// 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;
+ }
};
/// Canonical scalar induction phi of the vector loop. Starting at the specified
@@ -1895,6 +1923,13 @@
VPCanonicalIVPHIRecipe *getCanonicalIV() const;
VPValue *getStartValue() const { return getOperand(1); }
VPValue *getStepValue() const { return getOperand(2); }
+
+ /// 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;
+ }
};
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120827.414061.patch
Type: text/x-patch
Size: 2507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220309/4afb5222/attachment.bin>
More information about the llvm-commits
mailing list