[Mlir-commits] [mlir] 93ccd7c - [MLIR][Presburger] fix bug where Simplex::addZeroRow was not undoable

Arjun P llvmlistbot at llvm.org
Tue Mar 22 06:11:47 PDT 2022


Author: Arjun P
Date: 2022-03-22T13:11:56Z
New Revision: 93ccd7c490ede05b5e8d004349c62d3eb9d032aa

URL: https://github.com/llvm/llvm-project/commit/93ccd7c490ede05b5e8d004349c62d3eb9d032aa
DIFF: https://github.com/llvm/llvm-project/commit/93ccd7c490ede05b5e8d004349c62d3eb9d032aa.diff

LOG: [MLIR][Presburger] fix bug where Simplex::addZeroRow was not undoable

Previously, an UndoLogEntry was added by addRow but not by addZeroRow. So
calling directly into addZeroRow, as LexSimplex::addCut does, was not an
undoable operation. In the current usage of addCut this could never
lead to an incorrect result, and addZeroRow is protected, so it is not
currently possible to add a regression test for this. This bug needs to be
fixed for the symbolic integer lexmin algorithm.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122162

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/Simplex.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index dff773690e573..8c9f017fb7b61 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -66,6 +66,7 @@ unsigned SimplexBase::addZeroRow(bool makeRestricted) {
     tableau.resizeVertically(nRow);
   rowUnknown.push_back(~con.size());
   con.emplace_back(Orientation::Row, makeRestricted, nRow - 1);
+  undoLog.push_back(UndoLogEntry::RemoveLastConstraint);
 
   // Zero out the new row.
   tableau.fillRow(nRow - 1, 0);
@@ -131,7 +132,6 @@ unsigned SimplexBase::addRow(ArrayRef<int64_t> coeffs, bool makeRestricted) {
 
   normalizeRow(nRow - 1);
   // Push to undo log along with the index of the new constraint.
-  undoLog.push_back(UndoLogEntry::RemoveLastConstraint);
   return con.size() - 1;
 }
 


        


More information about the Mlir-commits mailing list