diff --git a/mlir/include/mlir/Analysis/Presburger/Matrix.h b/mlir/include/mlir/Analysis/Presburger/Matrix.h --- a/mlir/include/mlir/Analysis/Presburger/Matrix.h +++ b/mlir/include/mlir/Analysis/Presburger/Matrix.h @@ -72,7 +72,8 @@ /// 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 --- a/mlir/lib/Analysis/Presburger/Matrix.cpp +++ b/mlir/lib/Analysis/Presburger/Matrix.cpp @@ -101,6 +101,10 @@ 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}; }