[llvm-branch-commits] [llvm] [LoopVectorize] Support vectorization of compressing patterns (PR #214491)

Benjamin Maxwell via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 14 06:13:30 PDT 2026


================
@@ -2903,6 +2920,38 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
     AddToWorklistIfAllowed(IndUpdate);
   }
 
+  // Handle monotonic phis (similarly to induction vars).
+  for (const auto &MonotonicPHI : Legal->getMonotonicPHIs()) {
----------------
MacDue wrote:

This is more done for the negative cases than the positive as this patch does not support non-uniform uses of any `MonotonicPHI`. The `MonotonicDescriptor` currently just looks for the simple monotonic IV pattern, but not necessarily how it's used.

I'm not sure exactly what the changes would look like to the descriptor yet, but I think `collectLoopUniforms` is a fairly sensible place to check it as it reuses some of the existing uniformity checks. I'd push back a little on the recurrence descriptor being a 'good' example, as it's really quite complex and hard to follow.  

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


More information about the llvm-branch-commits mailing list