[Mlir-commits] [mlir] 68575dd - Matrix::getRow non-const

Arjun P llvmlistbot at llvm.org
Mon Mar 21 07:16:20 PDT 2022


Author: Arjun P
Date: 2022-03-21T14:16:24Z
New Revision: 68575ddea52d3104a7a6e2998fa05be278b99b34

URL: https://github.com/llvm/llvm-project/commit/68575ddea52d3104a7a6e2998fa05be278b99b34
DIFF: https://github.com/llvm/llvm-project/commit/68575ddea52d3104a7a6e2998fa05be278b99b34.diff

LOG: Matrix::getRow non-const

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/Presburger/Matrix.h
    mlir/lib/Analysis/Presburger/Matrix.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/Presburger/Matrix.h b/mlir/include/mlir/Analysis/Presburger/Matrix.h
index ff4835ed52a5f..940b88d8148f4 100644
--- a/mlir/include/mlir/Analysis/Presburger/Matrix.h
+++ b/mlir/include/mlir/Analysis/Presburger/Matrix.h
@@ -72,7 +72,8 @@ class Matrix {
   /// reallocations.
   void reserveRows(unsigned rows);
 
-  /// Get an ArrayRef corresponding to the specified row.
+  /// Get a [Mutable]ArrayRef corresponding to the specified row.
+  MutableArrayRef<int64_t> getRow(unsigned row);
   ArrayRef<int64_t> getRow(unsigned row) const;
 
   /// Insert columns having positions pos, pos + 1, ... pos + count - 1.

diff  --git a/mlir/lib/Analysis/Presburger/Matrix.cpp b/mlir/lib/Analysis/Presburger/Matrix.cpp
index f44405ae12351..2bfa5c37637fc 100644
--- a/mlir/lib/Analysis/Presburger/Matrix.cpp
+++ b/mlir/lib/Analysis/Presburger/Matrix.cpp
@@ -101,6 +101,10 @@ void Matrix::swapColumns(unsigned column, unsigned otherColumn) {
     std::swap(at(row, column), at(row, otherColumn));
 }
 
+MutableArrayRef<int64_t> Matrix::getRow(unsigned row) {
+  return {&data[row * nReservedColumns], nColumns};
+}
+
 ArrayRef<int64_t> Matrix::getRow(unsigned row) const {
   return {&data[row * nReservedColumns], nColumns};
 }


        


More information about the Mlir-commits mailing list