[llvm] [LoopVectorize] Add support for vectorisation of more early exit loops (PR #88385)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 02:06:41 PDT 2024


================
@@ -2514,14 +2545,20 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI,
 
   // Check if we see any stores. If there are no stores, then we don't
   // care if the pointers are *restrict*.
+  bool CanVecMem = false;
   if (!Stores.size()) {
     LLVM_DEBUG(dbgs() << "LAA: Found a read-only loop!\n");
-    return true;
+    // Don't return yet if there are uncountable exits because we also need to
+    // record all of the underlying objects for memory fault analysis.
+    if (!UncountableExitingBlocks.size())
+      return true;
----------------
david-arm wrote:

OK I can look into that, but in that case I would like to move any such code out of LoopVectorizationLegality so that other users may benefit, since it's not strictly limited to loop vectorisation. I think that asking a question about whether a loop may fault or not is useful in the wider compiler. I could split this off in a separate PR and see if there is a way to write tests for it.

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


More information about the llvm-commits mailing list