[Mlir-commits] [mlir] d98dfde - [MLIR][Presburger] add a non-const Matrix::getRow() returning a MutableArrayRef
Arjun P
llvmlistbot at llvm.org
Mon Mar 21 08:17:13 PDT 2022
Author: Arjun P
Date: 2022-03-21T15:17:16Z
New Revision: d98dfdea1773727731e6bd128b318c82f61843fd
URL: https://github.com/llvm/llvm-project/commit/d98dfdea1773727731e6bd128b318c82f61843fd
DIFF: https://github.com/llvm/llvm-project/commit/d98dfdea1773727731e6bd128b318c82f61843fd.diff
LOG: [MLIR][Presburger] add a non-const Matrix::getRow() returning a MutableArrayRef
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D122136
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