[llvm] [LV][NFC]Preselect folding style before choosing maxing VF, NFC. (PR #81885)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 08:36:30 PST 2024


================
@@ -1509,15 +1509,27 @@ class LoopVectorizationCostModel {
   }
 
   /// Returns the TailFoldingStyle that is best for the current loop.
-  TailFoldingStyle
-  getTailFoldingStyle(bool IVUpdateMayOverflow = true) const {
-    if (!CanFoldTailByMasking)
-      return TailFoldingStyle::None;
+  TailFoldingStyle getTailFoldingStyle(bool IVUpdateMayOverflow = true) const {
+    return IVUpdateMayOverflow ? ChosenTailFoldingStyle.first
+                               : ChosenTailFoldingStyle.second;
+  }
+
+  /// Selects and saves TailFoldingStyle for 2 options - if IV may overflow or
+  /// not.
+  void selectTailFoldinStyle() {
+    if (!Legal->prepareToFoldTailByMasking())
----------------
fhahn wrote:

nit: would be good assert that ChosenTailFoldingStyle is set to None 

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


More information about the llvm-commits mailing list