[MLIR][Presburger] fourier-motzkin: check if all LCMs are 1 using a bool instead...
authorArjun P <arjunpitchanathan@gmail.com>
Thu, 4 Aug 2022 17:42:51 +0000 (18:42 +0100)
committerArjun P <arjunpitchanathan@gmail.com>
Thu, 4 Aug 2022 18:14:39 +0000 (19:14 +0100)
commitbad95b72eed0d685874e19f4314f64fb081370af
treed5ed98720aaac53109122631ca93a09c25787e13
parentf6bd0a8f2bc4b62f7f7800a7dd1de6ba764b56c6
[MLIR][Presburger] fourier-motzkin: check if all LCMs are 1 using a bool instead of by multiplying them

This can easily overflow and it is possible for these unsigned overflows to result in incorrect results.
For example, the two LCMs could be 641 and 6700417, which multiply to 2^32 + 1, which overflows to 1.
Unsigned overflows already occur in the existing tests.

Also, when switching to arbitrary-precision arithmetic, this results in a many
large integer multiplications resulting in a significant slowdown.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D131184
mlir/lib/Analysis/Presburger/IntegerRelation.cpp