20
20
#include " mlir/Analysis/Presburger/PresburgerSpace.h"
21
21
#include " mlir/Analysis/Presburger/Simplex.h"
22
22
#include " mlir/Analysis/Presburger/Utils.h"
23
- #include " mlir/Support/LLVM.h"
24
- #include " mlir/Support/LogicalResult.h"
25
23
#include " llvm/ADT/DenseMap.h"
26
24
#include " llvm/ADT/DenseSet.h"
27
25
#include " llvm/ADT/STLExtras.h"
@@ -1554,22 +1552,22 @@ static int findEqualityToConstant(const IntegerRelation &cst, unsigned pos,
1554
1552
return -1 ;
1555
1553
}
1556
1554
1557
- LogicalResult IntegerRelation::constantFoldVar (unsigned pos) {
1555
+ bool IntegerRelation::constantFoldVar (unsigned pos) {
1558
1556
assert (pos < getNumVars () && " invalid position" );
1559
1557
int rowIdx;
1560
1558
if ((rowIdx = findEqualityToConstant (*this , pos)) == -1 )
1561
- return failure () ;
1559
+ return false ;
1562
1560
1563
1561
// atEq(rowIdx, pos) is either -1 or 1.
1564
1562
assert (atEq (rowIdx, pos) * atEq (rowIdx, pos) == 1 );
1565
1563
DynamicAPInt constVal = -atEq (rowIdx, getNumCols () - 1 ) / atEq (rowIdx, pos);
1566
1564
setAndEliminate (pos, constVal);
1567
- return success () ;
1565
+ return true ;
1568
1566
}
1569
1567
1570
1568
void IntegerRelation::constantFoldVarRange (unsigned pos, unsigned num) {
1571
1569
for (unsigned s = pos, t = pos, e = pos + num; s < e; s++) {
1572
- if (failed ( constantFoldVar (t) ))
1570
+ if (! constantFoldVar (t))
1573
1571
t++;
1574
1572
}
1575
1573
}
@@ -1946,9 +1944,9 @@ void IntegerRelation::fourierMotzkinEliminate(unsigned pos, bool darkShadow,
1946
1944
for (unsigned r = 0 , e = getNumEqualities (); r < e; r++) {
1947
1945
if (atEq (r, pos) != 0 ) {
1948
1946
// Use Gaussian elimination here (since we have an equality).
1949
- LogicalResult ret = gaussianEliminateVar (pos);
1947
+ bool ret = gaussianEliminateVar (pos);
1950
1948
(void )ret;
1951
- assert (succeeded ( ret) && " Gaussian elimination guaranteed to succeed" );
1949
+ assert (ret && " Gaussian elimination guaranteed to succeed" );
1952
1950
LLVM_DEBUG (llvm::dbgs () << " FM output (through Gaussian elimination):\n " );
1953
1951
LLVM_DEBUG (dump ());
1954
1952
return ;
@@ -2175,8 +2173,7 @@ static void getCommonConstraints(const IntegerRelation &a,
2175
2173
2176
2174
// Computes the bounding box with respect to 'other' by finding the min of the
2177
2175
// 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) {
2180
2177
assert (space.isEqual (otherCst.getSpace ()) && " Spaces should match." );
2181
2178
assert (getNumLocalVars () == 0 && " local ids not supported yet here" );
2182
2179
@@ -2204,13 +2201,13 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
2204
2201
if (!extent.has_value ())
2205
2202
// TODO: symbolic extents when necessary.
2206
2203
// TODO: handle union if a dimension is unbounded.
2207
- return failure () ;
2204
+ return false ;
2208
2205
2209
2206
auto otherExtent = otherCst.getConstantBoundOnDimSize (
2210
2207
d, &otherLb, &otherLbFloorDivisor, &otherUb);
2211
2208
if (!otherExtent.has_value () || lbFloorDivisor != otherLbFloorDivisor)
2212
2209
// TODO: symbolic extents when necessary.
2213
- return failure () ;
2210
+ return false ;
2214
2211
2215
2212
assert (lbFloorDivisor > 0 && " divisor always expected to be positive" );
2216
2213
@@ -2230,7 +2227,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
2230
2227
auto constLb = getConstantBound (BoundType::LB, d);
2231
2228
auto constOtherLb = otherCst.getConstantBound (BoundType::LB, d);
2232
2229
if (!constLb.has_value () || !constOtherLb.has_value ())
2233
- return failure () ;
2230
+ return false ;
2234
2231
std::fill (minLb.begin (), minLb.end (), 0 );
2235
2232
minLb.back () = std::min (*constLb, *constOtherLb);
2236
2233
}
@@ -2246,7 +2243,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
2246
2243
auto constUb = getConstantBound (BoundType::UB, d);
2247
2244
auto constOtherUb = otherCst.getConstantBound (BoundType::UB, d);
2248
2245
if (!constUb.has_value () || !constOtherUb.has_value ())
2249
- return failure () ;
2246
+ return false ;
2250
2247
std::fill (maxUb.begin (), maxUb.end (), 0 );
2251
2248
maxUb.back () = std::max (*constUb, *constOtherUb);
2252
2249
}
@@ -2284,7 +2281,7 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
2284
2281
// union (since the above are just the union along dimensions); we shouldn't
2285
2282
// be discarding any other constraints on the symbols.
2286
2283
2287
- return success () ;
2284
+ return true ;
2288
2285
}
2289
2286
2290
2287
bool IntegerRelation::isColZero (unsigned pos) const {
0 commit comments