[llvm] [SandboxVec][VecUtils] Lane Enumerator (PR #188355)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 09:03:25 PDT 2026


================
@@ -304,6 +305,69 @@ class VecUtils {
                                      WhereIt, Ctx, "Unpack");
   }
 
+  /// Iterate over all lanes and Value pairs commulatively.
+  // For example, given a range: {i32 %v0, <2 x i32> %v1, i32 %v2} we get:
+  //  Lane Elm
+  //   0   %v0
+  //   1   %v1
+  //   3   %v2
+  template <typename RangeT, typename RangeIteratorT>
+  class LaneValueEnumerator {
+    const RangeT &Range;
+    /// Cummulative Lane count.
+    unsigned Lane;
+    /// Points to current element.
+    RangeIteratorT It;
+    RangeIteratorT ItE;
+
+  public:
+    LaneValueEnumerator(const RangeT &Range, unsigned Lane, RangeIteratorT It,
----------------
slackito wrote:

How about calling the `Lane` argument something like `FirstLane`? and maybe add to the class description a couple of words saying it supports starting at a number != 0.

Also the `It` and `ItE` argument names don't look very descriptive from the outside. Maybe `Begin` and `End`?

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


More information about the llvm-commits mailing list