[llvm] [LV, VP]VP intrinsics support for the Loop Vectorizer + adding new tail-folding mode using EVL. (PR #76172)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 24 06:40:00 PDT 2024


================
@@ -1505,20 +1508,60 @@ class LoopVectorizationCostModel {
 
   /// Returns the TailFoldingStyle that is best for the current loop.
   TailFoldingStyle getTailFoldingStyle(bool IVUpdateMayOverflow = true) const {
-    return IVUpdateMayOverflow ? ChosenTailFoldingStyle.first
-                               : ChosenTailFoldingStyle.second;
+    if (!ChosenTailFoldingStyle.first) {
+      assert(!ChosenTailFoldingStyle.second &&
+             "Chosen tail folding style must not be set.");
+      return TailFoldingStyle::None;
+    }
----------------
ayalz wrote:


Instead of interpreting non-existing styles as None here, can setTailFoldingStyles() always set the styles, possibly to None, so that here we assert that we're only getting styles that have already been initialized
```suggestion
    assert(ChosenTailFoldingStyle.first && ChosenTailFoldingStyle.second &&
             "Must set styles before getting them.");
```
?

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


More information about the llvm-commits mailing list