From c9cea1909f58e8c9f8ea392b61f8188d1358fa73 Mon Sep 17 00:00:00 2001 From: Groverkss Date: Sun, 7 Nov 2021 10:45:20 +0530 Subject: [PATCH] Move division representation to a common function --- mlir/include/mlir/Analysis/AffineStructures.h | 6 ----- mlir/lib/Analysis/AffineStructures.cpp | 35 +++------------------------ 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/mlir/include/mlir/Analysis/AffineStructures.h b/mlir/include/mlir/Analysis/AffineStructures.h index 9e7c7b5..1a2766c 100644 --- a/mlir/include/mlir/Analysis/AffineStructures.h +++ b/mlir/include/mlir/Analysis/AffineStructures.h @@ -529,12 +529,6 @@ protected: /// 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> &reprs, - SmallVector &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 24ad0f1..3bb97df 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> &reprs, - SmallVector &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>> divIneqPairs( - getNumLocalIds()); - getLocalReprLbUbPairs(divIneqPairs); - - for (unsigned i = 0, e = getNumLocalIds(); i < e; ++i) { - if (!divIneqPairs[i].hasValue()) { - denominators[i] = 0; - continue; - } - - std::pair 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> divs1(fac1.getNumLocalIds()), divs2(fac2.getNumLocalIds()); - SmallVector denoms1(fac1.getNumLocalIds()), + SmallVector 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` -- 2.7.4