[Mlir-commits] [mlir] [MLIR][Presburger] Implement Matrix::moveColumns (PR #68362)

Kunwar Grover llvmlistbot at llvm.org
Fri Oct 6 22:08:54 PDT 2023


================
@@ -192,6 +192,30 @@ template <typename T> void Matrix<T>::fillRow(unsigned row, const T &value) {
     at(row, col) = value;
 }
 
+template <typename T> void Matrix<T>::moveColumns(unsigned srcPos, unsigned num, int offset) {
+  assert(num != 0 && "num must be non-zero");
+  assert(offset != 0 && "offset must be non-zero");
+  assert(0 <= srcPos + offset && srcPos + num + offset <= getNumColumns() &&
+      "invalid move offset");
+
+  unsigned insertCount = offset > 0 ? offset : -offset,
+           insertPos = offset > 0 ? srcPos : srcPos + num,
+           deletePos = offset > 0 ? srcPos + num : srcPos + offset;
+  // Insert new zero columns in the positions where the adjacent columns are to
----------------
Groverkss wrote:

Could you add a TODO that this can be done using std::rotate?

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


More information about the Mlir-commits mailing list