[llvm] [LV][AArch64] Prefer epilogue with fixed-width over scalable VF in case of equal costs. (PR #155546)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 00:57:31 PDT 2025


================
@@ -6017,7 +6017,13 @@ static bool containsDecreasingPointers(Loop *TheLoop,
   return false;
 }
 
-bool AArch64TTIImpl::preferFixedOverScalableIfEqualCost() const {
+bool AArch64TTIImpl::preferFixedOverScalableIfEqualCost(bool IsEpilogue) const {
+  // For cases like post-LTO vectorization, when we eventually know the trip
+  // count, epilogue with fixed-width vectorization can be deleted if the trip
+  // count is less than the epilogue iterations. That's why we prefer
+  // fixed-width vectorization in epilogue in case of equal costs.
+  if (IsEpilogue)
----------------
david-arm wrote:

I think we probably want this to happen after checking `SVEPreferFixedOverScalableIfEqualCost` so that we have a way to disable it. Also, it might be worth calling `useFixedOverScalableIfEqualCost(IsEpilogue)` to get the answer and setting this on a per-CPU basis.

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


More information about the llvm-commits mailing list