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

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 01:56:31 PDT 2024


================
@@ -608,6 +611,24 @@ class LoopAccessInfo {
   unsigned getNumStores() const { return NumStores; }
   unsigned getNumLoads() const { return NumLoads;}
 
+  /// Returns the block that exits early from the loop, if there is one.
+  /// Otherwise returns nullptr.
+  BasicBlock *getSpeculativeEarlyExitingBlock() const {
+    return SpeculativeEarlyExitingBB;
+  }
+
+  /// Returns the successor of the block that exits early from the loop, if
+  /// there is one. Otherwise returns nullptr.
+  BasicBlock *getSpeculativeEarlyExitBlock() const {
+    return SpeculativeEarlyExitBB;
+  }
+
+  /// Returns all blocks with a countable exit, i.e. the exit-not-taken count
+  /// is known exactly at compile time.
+  const SmallVector<BasicBlock *, 4> &getCountableEarlyExitingBlocks() const {
+    return CountableEarlyExitBlocks;
+  }
----------------
arcbbb wrote:

Both getCountableEarlyExitingBlocks and getExactExitingBlocks appear to refer to the same concept. To ensure consistency, should we consider renaming one of them?

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


More information about the llvm-commits mailing list