[MLIR][Presburger] IntegerRelation: implement partial rollback support
authorArjun P <arjunpitchanathan@gmail.com>
Wed, 23 Mar 2022 23:40:20 +0000 (23:40 +0000)
committerArjun P <arjunpitchanathan@gmail.com>
Thu, 24 Mar 2022 00:27:21 +0000 (00:27 +0000)
commit93b9f50b4c6e84626f976df95602af3ecbb98ce4
tree16054999c835b204b257ff1fe046c4f2a7d27e3c
parent9a8a0a38613ae190740923a7dcdf381a1b6fc55e
[MLIR][Presburger] IntegerRelation: implement partial rollback support

It is often necessary to "rollback" IntegerRelations to an earlier state. Although providing full rollback support is non-trivial, we really only need to support the case where the only changes made are to append ids or append constraints, and then rollback these additions. This patch adds support to rollback in such situations by recording the number of ids and constraints of each kind and providing support to truncate the IntegerRelation to those counts by removing appended ids and constraints. This already simplifies subtraction a little bit and will also be useful in the implementation of symbolic integer lexmin.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D122178
mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h
mlir/lib/Analysis/Presburger/IntegerRelation.cpp
mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
mlir/lib/Analysis/Presburger/PresburgerSpace.cpp