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

Kunwar Grover llvmlistbot at llvm.org
Wed Oct 11 04:10:00 PDT 2023


================
@@ -192,6 +192,36 @@ 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, unsigned dstPos) {
+  if(num == 0)
+    return;
+
+  int offset = dstPos - srcPos;
+  if(offset == 0)
+    return;
+
+  assert(0 <= srcPos + offset && srcPos + num + offset <= getNumColumns() &&
+      "invalid move num");
+
+  unsigned insertCount = offset > 0 ? offset : -offset,
+           insertPos = offset > 0 ? srcPos : srcPos + num,
+           deletePos = offset > 0 ? srcPos + num : srcPos + offset;
----------------
Groverkss wrote:

Can you write these in seperate statements?

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


More information about the Mlir-commits mailing list