[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
Thu Aug 28 01:57:55 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:

Yeah that's probably true. I was just thinking of limiting this for now to specific CPUs where we have observed the problem, but maybe that's unnecessary. I guess we can leave like it this for now.

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


More information about the llvm-commits mailing list