[Mlir-commits] [mlir] c9cea19 - Move division representation to a common function
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Dec 2 13:59:05 PST 2021
Author: Groverkss
Date: 2021-12-03T03:23:18+05:30
New Revision: c9cea1909f58e8c9f8ea392b61f8188d1358fa73
URL: https://github.com/llvm/llvm-project/commit/c9cea1909f58e8c9f8ea392b61f8188d1358fa73
DIFF: https://github.com/llvm/llvm-project/commit/c9cea1909f58e8c9f8ea392b61f8188d1358fa73.diff
LOG: Move division representation to a common function
Added:
Modified:
mlir/include/mlir/Analysis/AffineStructures.h
mlir/lib/Analysis/AffineStructures.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Analysis/AffineStructures.h b/mlir/include/mlir/Analysis/AffineStructures.h
index 9e7c7b504ed0..1a2766c020bc 100644
--- a/mlir/include/mlir/Analysis/AffineStructures.h
+++ b/mlir/include/mlir/Analysis/AffineStructures.h
@@ -529,12 +529,6 @@ class FlatAffineConstraints {
/// Normalized each constraints by the GCD of its coefficients.
void normalizeConstraintsByGCD();
- /// Get division representations for each local identifier. If no local
- /// representation exists for the `i^th` local identifier, denominator[i] is
- /// set to 0.
- void getLocalIdsReprs(std::vector<SmallVector<int64_t, 8>> &reprs,
- SmallVector<unsigned, 8> &denominator);
-
/// Removes identifiers in the column range [idStart, idLimit), and copies any
/// remaining valid data into place, updates member variables, and resizes
/// arrays as needed.
diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp
index 24ad0f1cb826..3bb97df5f656 100644
--- a/mlir/lib/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Analysis/AffineStructures.cpp
@@ -1918,35 +1918,6 @@ void FlatAffineConstraints::removeRedundantConstraints() {
equalities.resizeVertically(pos);
}
-void FlatAffineConstraints::getLocalIdsReprs(
- std::vector<SmallVector<int64_t, 8>> &reprs,
- SmallVector<unsigned, 8> &denominators) {
-
- assert(reprs.size() == getNumLocalIds() &&
- "Size of reprs must be equal to number of local ids");
- assert(denominators.size() == getNumLocalIds() &&
- "Size of denominators must be equal to number of local ids");
-
- // Get upper-lower bound inequality pairs for division representation.
- std::vector<Optional<std::pair<unsigned, unsigned>>> divIneqPairs(
- getNumLocalIds());
- getLocalReprLbUbPairs(divIneqPairs);
-
- for (unsigned i = 0, e = getNumLocalIds(); i < e; ++i) {
- if (!divIneqPairs[i].hasValue()) {
- denominators[i] = 0;
- continue;
- }
-
- std::pair<unsigned, unsigned> divPair = divIneqPairs[i].getValue();
- LogicalResult divExtracted =
- getDivRepr(*this, i + getIdKindOffset(IdKind::Local), divPair.first,
- divPair.second, reprs[i], denominators[i]);
- assert(succeeded(divExtracted) &&
- "Div should have been found since ub-lb pair exists");
- }
-}
-
/// Merge local identifer at `pos2` into local identifer at `pos1` in `fac`.
static void mergeDivision(FlatAffineConstraints &fac, unsigned pos1,
unsigned pos2) {
@@ -1972,10 +1943,10 @@ void FlatAffineConstraints::mergeLocalIds(FlatAffineConstraints &other) {
// Get divisions inequality pairs from each FAC.
std::vector<SmallVector<int64_t, 8>> divs1(fac1.getNumLocalIds()),
divs2(fac2.getNumLocalIds());
- SmallVector<unsigned, 8> denoms1(fac1.getNumLocalIds()),
+ SmallVector<unsigned, 4> denoms1(fac1.getNumLocalIds()),
denoms2(fac2.getNumLocalIds());
- fac1.getLocalIdsReprs(divs1, denoms1);
- fac2.getLocalIdsReprs(divs2, denoms2);
+ fac1.getLocalReprs(divs1, denoms1);
+ fac2.getLocalReprs(divs2, denoms2);
// Merge local ids of fac1 and fac2 without using division information,
// i.e. append local ids of `fac2` to `fac1` and insert local ids of `fac1`
More information about the Mlir-commits
mailing list