summaryrefslogtreecommitdiff
path: root/mlir/lib/IR/AffineMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/IR/AffineMap.cpp')
-rw-r--r--mlir/lib/IR/AffineMap.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/mlir/lib/IR/AffineMap.cpp b/mlir/lib/IR/AffineMap.cpp
index 411ac656e4af..e5993eb08dc8 100644
--- a/mlir/lib/IR/AffineMap.cpp
+++ b/mlir/lib/IR/AffineMap.cpp
@@ -13,12 +13,12 @@
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Support/LogicalResult.h"
-#include "mlir/Support/MathExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <numeric>
@@ -27,6 +27,10 @@
using namespace mlir;
+using llvm::divideCeilSigned;
+using llvm::divideFloorSigned;
+using llvm::mod;
+
namespace {
// AffineExprConstantFolder evaluates an affine expression using constant
@@ -73,7 +77,7 @@ private:
hasPoison_ = true;
return std::nullopt;
}
- return floorDiv(lhs, rhs);
+ return divideFloorSigned(lhs, rhs);
});
case AffineExprKind::CeilDiv:
return constantFoldBinExpr(
@@ -82,7 +86,7 @@ private:
hasPoison_ = true;
return std::nullopt;
}
- return ceilDiv(lhs, rhs);
+ return divideCeilSigned(lhs, rhs);
});
case AffineExprKind::Constant:
return cast<AffineConstantExpr>(expr).getValue();
@@ -744,8 +748,7 @@ AffineMap mlir::simplifyAffineMap(AffineMap map) {
AffineMap mlir::removeDuplicateExprs(AffineMap map) {
auto results = map.getResults();
SmallVector<AffineExpr, 4> uniqueExprs(results.begin(), results.end());
- uniqueExprs.erase(std::unique(uniqueExprs.begin(), uniqueExprs.end()),
- uniqueExprs.end());
+ uniqueExprs.erase(llvm::unique(uniqueExprs), uniqueExprs.end());
return AffineMap::get(map.getNumDims(), map.getNumSymbols(), uniqueExprs,
map.getContext());
}