[llvm] [LoopVectorize] Teach LoopVectorizationLegality about more early exits (PR #107004)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 10:33:09 PDT 2024


================
@@ -1070,6 +1070,51 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
     return false;
   }
 
+  // For loops with uncountable early exiting blocks that are not the latch
+  // it's necessary to perform extra checks, since the vectoriser is currently
+  // only capable of handling simple search loops.
+  if (IsEarlyExitLoop) {
----------------
paulwalker-arm wrote:

Not sure what others think but I see `canVectorizeMemory` as being about load/store address analysis rather than "the only place to analyse load/store instructions". In this case you don't care about the addresses, you just want to guard against introducing side effects which I think can all be contained in `isVectorizableEarlyExitLoop`?

It kind of feels odd for `canVectorizeMemory` to depend on work done by `isVectorizableEarlyExitLoop`, when the "reason to reject an instruction" is largely the same.

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


More information about the llvm-commits mailing list