[llvm] [LV] Vectorization of compress idiom (PR #83467)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 12:05:48 PST 2024


================
@@ -306,6 +310,42 @@ class LoopVectorizationLegality {
   /// Returns True if V is a Phi node of an induction variable in this loop.
   bool isInductionPhi(const Value *V) const;
 
+  /// Returns the Monotonics found in the loop
+  const MonotonicPhiList &getMonotonics() const { return MonotonicPhis; }
+
+  /// Returns the MonotonicDescriptor associated with an \p I instruction
+  /// Returns emtpy descriptor if \p I instruction is non-monotonic.
+  const MonotonicDescriptor *getMonotonicDescriptor(const Instruction *I) const {
+    for (const auto &PMD : getMonotonics()) {
+      if (const auto *Phi = dyn_cast<const PHINode>(I))
----------------
alexey-bataev wrote:

```suggestion
      if (const auto *Phi = dyn_cast<PHINode>(I))
```

https://github.com/llvm/llvm-project/pull/83467


More information about the llvm-commits mailing list