[llvm] [LV] Avoid low-trip-count vectorization for countable early exits (PR #225635)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 01:23:32 PDT 2026
https://github.com/fhahn commented:
> Hi, I think this
>
> ```
> For loops where an early exit condition is present, and the exiting block of the loop is not in the same block as the loop latch, the new transformation should not be applied.
> ```
>
> is only a partial solution. I believe @huntergr-arm has been working on supporting early exit loops where both the early exit condition and the latch condition are combined together in the same latch block, i.e.
>
> ```
> loop:
> ... stuff ...
> %ee_cond = icmp ugt i32 %ld, 3
> %latch_cond = icmp uge i64 %iv.next, %n
> %combined_cond = or i1 %ee_cond, %latch_cond
> br i1 %combined_cond, label %exit, %loop
> ```
>
> So you also need to worry about early exits where the exiting block _is_ the latch.
Yep, I am just worried that duplicating some checks here can be easy to miss, and there may also be other code paths that require a scalar epilogue and would need checking here too
https://github.com/llvm/llvm-project/pull/225635
More information about the llvm-commits
mailing list