[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 2 09:00:30 PST 2022


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: tschuett, psnobl, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.

This patch adds a helper to check if a recipe only uses scalars of a
given operand. This is similar to onlyFirstLaneUsed, which was
introduced earlier.

By default, onlyScalarsUsed falls back on onlyFirstLaneUsed.

Will be used by a follow-up patch.


Repository:
  rG LLVM Github Monorepo

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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120827.412447.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220302/44308dca/attachment.bin>


More information about the llvm-commits mailing list