2020#include " mlir/Analysis/Presburger/PresburgerSpace.h"
2121#include " mlir/Analysis/Presburger/Simplex.h"
2222#include " mlir/Analysis/Presburger/Utils.h"
23- #include " mlir/Support/LLVM.h"
24- #include " mlir/Support/LogicalResult.h"
2523#include " llvm/ADT/DenseMap.h"
2624#include " llvm/ADT/DenseSet.h"
2725#include " llvm/ADT/STLExtras.h"
@@ -1554,22 +1552,22 @@ static int findEqualityToConstant(const IntegerRelation &cst, unsigned pos,
15541552 return -1 ;
15551553}
15561554
1557- LogicalResult IntegerRelation::constantFoldVar (unsigned pos) {
1555+ bool IntegerRelation::constantFoldVar (unsigned pos) {
15581556 assert (pos < getNumVars () && " invalid position" );
15591557 int rowIdx;
15601558 if ((rowIdx = findEqualityToConstant (*this , pos)) == -1 )
1561- return failure () ;
1559+ return false ;
15621560
15631561 // atEq(rowIdx, pos) is either -1 or 1.
15641562 assert (atEq (rowIdx, pos) * atEq (rowIdx, pos) == 1 );
15651563 DynamicAPInt constVal = -atEq (rowIdx, getNumCols () - 1 ) / atEq (rowIdx, pos);
15661564 setAndEliminate (pos, constVal);
1567- return success () ;
1565+ return true ;
15681566}
15691567
15701568void IntegerRelation::constantFoldVarRange (unsigned pos, unsigned num) {
15711569 for (unsigned s = pos, t = pos, e = pos + num; s < e; s++) {
1572- if (failed ( constantFoldVar (t) ))
1570+ if (! constantFoldVar (t))
15731571 t++;
15741572 }
15751573}
@@ -1946,9 +1944,9 @@ void IntegerRelation::fourierMotzkinEliminate(unsigned pos, bool darkShadow,
19461944 for (unsigned r = 0 , e = getNumEqualities (); r < e; r++) {
19471945 if (atEq (r, pos) != 0 ) {
19481946 // Use Gaussian elimination here (since we have an equality).
1949- LogicalResult ret = gaussianEliminateVar (pos);
1947+ bool ret = gaussianEliminateVar (pos);
19501948 (void )ret;
1951- assert (succeeded ( ret) && " Gaussian elimination guaranteed to succeed" );
1949+ assert (ret && " Gaussian elimination guaranteed to succeed" );
19521950 LLVM_DEBUG (llvm::dbgs () << " FM output (through Gaussian elimination):\n " );
19531951 LLVM_DEBUG (dump ());
19541952 return ;
@@ -2175,8 +2173,7 @@ static void getCommonConstraints(const IntegerRelation &a,
21752173
21762174// Computes the bounding box with respect to 'other' by finding the min of the
21772175// lower bounds and the max of the upper bounds along each of the dimensions.
2178- LogicalResult
2179- IntegerRelation::unionBoundingBox (const IntegerRelation &otherCst) {
2176+ bool IntegerRelation::unionBoundingBox (const IntegerRelation &otherCst) {
21802177 assert (space.isEqual (otherCst.getSpace ()) && " Spaces should match." );
21812178 assert (getNumLocalVars () == 0 && " local ids not supported yet here" );
21822179
@@ -2204,13 +2201,13 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
22042201 if (!extent.has_value ())
22052202 // TODO: symbolic extents when necessary.
22062203 // TODO: handle union if a dimension is unbounded.
2207- return failure () ;
2204+ return false ;
22082205
22092206 auto otherExtent = otherCst.getConstantBoundOnDimSize (
22102207 d, &otherLb, &otherLbFloorDivisor, &otherUb);
22112208 if (!otherExtent.has_value () || lbFloorDivisor != otherLbFloorDivisor)
22122209 // TODO: symbolic extents when necessary.
2213- return failure () ;
2210+ return false ;
22142211
22152212 assert (lbFloorDivisor > 0 && " divisor always expected to be positive" );
22162213
@@ -2230,7 +2227,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
22302227 auto constLb = getConstantBound (BoundType::LB, d);
22312228 auto constOtherLb = otherCst.getConstantBound (BoundType::LB, d);
22322229 if (!constLb.has_value () || !constOtherLb.has_value ())
2233- return failure () ;
2230+ return false ;
22342231 std::fill (minLb.begin (), minLb.end (), 0 );
22352232 minLb.back () = std::min (*constLb, *constOtherLb);
22362233 }
@@ -2246,7 +2243,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
22462243 auto constUb = getConstantBound (BoundType::UB, d);
22472244 auto constOtherUb = otherCst.getConstantBound (BoundType::UB, d);
22482245 if (!constUb.has_value () || !constOtherUb.has_value ())
2249- return failure () ;
2246+ return false ;
22502247 std::fill (maxUb.begin (), maxUb.end (), 0 );
22512248 maxUb.back () = std::max (*constUb, *constOtherUb);
22522249 }
@@ -2284,7 +2281,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
22842281 // union (since the above are just the union along dimensions); we shouldn't
22852282 // be discarding any other constraints on the symbols.
22862283
2287- return success () ;
2284+ return true ;
22882285}
22892286
22902287bool IntegerRelation::isColZero (unsigned pos) const {
0 commit comments