[llvm] [LV] Transform to handle exits in the scalar loop (PR #148626)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 01:57:39 PST 2025


================
@@ -4182,6 +4182,14 @@ class VPlan {
   /// VPlan is destroyed.
   SmallVector<VPBlockBase *> CreatedBlocks;
 
+  /// The entry block in a vplan, which may be a check block that needs to
+  /// be wired up in the right place with existing check blocks.
+  std::optional<VPBasicBlock *> EarlyExitPreheader;
+
+  /// Indicates that an early exit loop will exit before the condition is
+  /// reached, and that the scalar loop must perform the last few iterations.
----------------
gbossu wrote:

Also, isn't this only set for uncountable early exits? My current understanding is that countable early exits may also force the scalar loop to run earlier than expected, even though `EarlyExitContinuesInScalarLoop` is false.

If so, maybe adjust the comment to specify it is specific to uncountable exits. If not, I guess `EarlyExitContinuesInScalarLoop` should be set to `true` more often?

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


More information about the llvm-commits mailing list