[llvm] [VPlan] Move tail folding out of VPlanPredicator. NFC (PR #176143)
Andrei Elovikov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 09:11:30 PST 2026
================
@@ -427,14 +427,44 @@ struct VPlanTransforms {
static void narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
TypeSize VectorRegWidth);
+ /// Adapts the vector loop region for tail folding by introducing a header
+ /// mask and predicating the region:
+ ///
+ /// Vector loop region before:
+ /// +-------------------------------------------+
+ /// |%iv = ... |
+ /// |... |
+ /// |%iv.next = add %iv, vfxuf |
+ /// |branch-on-count %iv.next, vector-trip-count|
+ /// +-------------------------------------------+
+ ///
+ /// Vector loop region after:
+ /// +-------------------------------------------+
+ /// |%iv = ... |
+ /// |%wide.iv = widen-canonical-iv ... |
+ /// |%header-mask = icmp ult %wide.iv, BTC |
+ /// |branch-on-cond %header-mask |---+
+ /// +-------------------------------------------+ |
+ /// | |
+ /// v |
+ /// +-------------------------------------------+ |
+ /// | ... | |
+ /// +-------------------------------------------+ |
+ /// | |
+ /// v |
+ /// +-------------------------------------------+ |
+ /// |%iv.next = add %iv, vfxuf |<--+
----------------
eas wrote:
```suggestion
/// <new phis> |<--+
/// |%iv.next = add %iv, vfxuf |
```
https://github.com/llvm/llvm-project/pull/176143
More information about the llvm-commits
mailing list