[llvm] [VPlan] Move tail folding out of VPlanPredicator. NFC (PR #176143)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 08:39:27 PST 2026


================
@@ -444,10 +444,44 @@ struct VPlanTransforms {
   static std::unique_ptr<VPlan>
   narrowInterleaveGroups(VPlan &Plan, const TargetTransformInfo &TTI);
 
+  /// Adapts the vector loop region for tail folding by introducing a header
+  /// mask and conditionally executing the content of 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      |
----------------
fhahn wrote:

```suggestion
  /// |%header-mask = icmp ule %wide.iv, BTC      |
```

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


More information about the llvm-commits mailing list