[llvm] [LV][AArch64] Prefer Fixed over Scalable if cost-model is equal (Neoverse V2) (PR #95819)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 23:54:24 PDT 2024


================
@@ -4780,7 +4780,10 @@ bool LoopVectorizationPlanner::isMoreProfitable(
   // Assume vscale may be larger than 1 (or the value being tuned for),
   // so that scalable vectorization is slightly favorable over fixed-width
   // vectorization.
-  bool PreferScalable = A.Width.isScalable() && !B.Width.isScalable();
+  bool PreferScalable = false;
+  if (!TTI.preferFixedIfEqualToScalable())
+    PreferScalable = A.Width.isScalable() && !B.Width.isScalable();
----------------
davemgreen wrote:

This may be better as 
```
if (!TTI.preferFixedIfEqualToScalable())
  PreferScalable = !A.Width.isScalable() && B.Width.isScalable();
else
  PreferScalable = A.Width.isScalable() && !B.Width.isScalable();
```
This way it will not be dependent upon the order it visits the vplans.

PreferScalable could then do with a better name too.

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


More information about the llvm-commits mailing list