[llvm] [LV][NFC] Refactor structures used to maintain uncountable exit info (PR #123219)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 14:40:32 PST 2025


================
@@ -654,18 +649,13 @@ class LoopVectorizationLegality {
   /// supported.
   bool StructVecCallFound = false;
 
-  /// Indicates whether this loop has an uncountable early exit, i.e. an
-  /// uncountable exiting block that is not the latch.
-  bool HasUncountableEarlyExit = false;
-
   /// Keep track of all the countable and uncountable exiting blocks if
   /// the exact backedge taken count is not computable.
   SmallVector<BasicBlock *, 4> CountableExitingBlocks;
-  SmallVector<BasicBlock *, 4> UncountableExitingBlocks;
 
-  /// Keep track of the destinations of all uncountable exits if the
-  /// exact backedge taken count is not computable.
-  SmallVector<BasicBlock *, 4> UncountableExitBlocks;
+  /// Keep track of all the loop edges with uncountable exits, where each entry
+  /// is a pair of (Exiting, Exit) blocks.
+  SmallVector<std::pair<BasicBlock *, BasicBlock *>, 4> UncountableEdges;
----------------
fhahn wrote:

While you are here, could we just make this a single std::optional<>, as at the moment we only support the case with a single edge? Better to generalize this once actually supported, as using a vector to store either 0 or 1 element may be bit confusing


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


More information about the llvm-commits mailing list