diff --git a/mlir/include/mlir/Analysis/Presburger/Matrix.h b/mlir/include/mlir/Analysis/Presburger/Matrix.h index ff4835ed52a5f7..940b88d8148f43 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 getRow(unsigned row); ArrayRef 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 f44405ae12351e..2bfa5c37637fc1 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 Matrix::getRow(unsigned row) { + return {&data[row * nReservedColumns], nColumns}; +} + ArrayRef Matrix::getRow(unsigned row) const { return {&data[row * nReservedColumns], nColumns}; }