[llvm] [VPlan] Introduce recipes for VP loads and stores. (PR #87816)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 11:09:41 PDT 2024
================
@@ -2392,7 +2391,51 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
bool onlyFirstLaneUsed(const VPValue *Op) const override {
assert(is_contained(operands(), Op) &&
"Op must be an operand of the recipe");
+ // Widened, consecutive memory operations only demand the first lane of
+ // their address, unless the same operand is also stored. That latter can
+ // happen with opaque pointers.
+ return Op == getAddr() && isConsecutive();
+ }
+};
+/// A recipe for widening load operations with vector-predication intrinsics,
+/// using the address to load from, the explicit vector length and an optional
+/// mask.
+struct VPWidenVPLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
+ VPWidenVPLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *EVL,
+ VPValue *Mask, bool IsConsecutive, DebugLoc DL)
+ : VPWidenMemoryRecipe(VPDef::VPWidenVPLoadSC, Load, {Addr, EVL},
+ IsConsecutive, false, DL),
+ VPValue(this, &Load) {
+ setMask(Mask);
+ }
+
+ VPRecipeBase *clone() override {
+ return new VPWidenVPLoadRecipe(cast<LoadInst>(Ingredient), getAddr(),
+ getEVL(), getMask(), isConsecutive(),
+ getDebugLoc());
----------------
ayalz wrote:
+1
Currently clone() is called only for epilog vectorization, so this is unreachable.
Can define it unreachable at the VPWidenMemoryRecipe parent, instead of pure virtual.
https://github.com/llvm/llvm-project/pull/87816
More information about the llvm-commits
mailing list