diff --git a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h --- a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h +++ b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h @@ -285,12 +285,14 @@ /// and the denominators in `denominators`. If no explicit representation /// could be found for the `i^th` local identifier, `denominators[i]` is set /// to 0. - void getLocalReprs(std::vector> ÷nds, - SmallVector &denominators, - std::vector &repr) const; - void getLocalReprs(std::vector &repr) const; - void getLocalReprs(std::vector> ÷nds, - SmallVector &denominators) const; + void + getLocalReprs(SmallVectorImpl> ÷nds, + SmallVectorImpl &denominators, + SmallVectorImpl &repr) const; + void + getLocalReprs(SmallVectorImpl &repr) const; + void getLocalReprs(SmallVectorImpl> ÷nds, + SmallVectorImpl &denominators) const; /// The type of bound: equal, lower bound or upper bound. enum BoundType { EQ, LB, UB }; diff --git a/mlir/include/mlir/Analysis/Presburger/Utils.h b/mlir/include/mlir/Analysis/Presburger/Utils.h --- a/mlir/include/mlir/Analysis/Presburger/Utils.h +++ b/mlir/include/mlir/Analysis/Presburger/Utils.h @@ -65,7 +65,7 @@ /// the divisions are not merged. `merge` can also do side effects, For example /// it can merge the local identifiers in IntegerPolyhedron. void removeDuplicateDivs( - std::vector> &divs, + SmallVectorImpl> &divs, SmallVectorImpl &denoms, unsigned localOffset, llvm::function_ref merge); diff --git a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp --- a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp +++ b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp @@ -829,23 +829,24 @@ return true; } -void IntegerPolyhedron::getLocalReprs(std::vector &repr) const { - std::vector> dividends(getNumLocalIds()); +void IntegerPolyhedron::getLocalReprs( + SmallVectorImpl &repr) const { + SmallVector> dividends(getNumLocalIds()); SmallVector denominators(getNumLocalIds()); getLocalReprs(dividends, denominators, repr); } void IntegerPolyhedron::getLocalReprs( - std::vector> ÷nds, - SmallVector &denominators) const { - std::vector repr(getNumLocalIds()); + SmallVectorImpl> ÷nds, + SmallVectorImpl &denominators) const { + SmallVector repr(getNumLocalIds()); getLocalReprs(dividends, denominators, repr); } void IntegerPolyhedron::getLocalReprs( - std::vector> ÷nds, - SmallVector &denominators, - std::vector &repr) const { + SmallVectorImpl> ÷nds, + SmallVectorImpl &denominators, + SmallVectorImpl &repr) const { repr.resize(getNumLocalIds()); dividends.resize(getNumLocalIds()); @@ -1103,7 +1104,7 @@ polyB.insertLocalId(0, initLocals); // Get division representations from each poly. - std::vector> divsA, divsB; + SmallVector> divsA, divsB; SmallVector denomsA, denomsB; polyA.getLocalReprs(divsA, denomsA); polyB.getLocalReprs(divsB, denomsB); diff --git a/mlir/lib/Analysis/Presburger/PresburgerSet.cpp b/mlir/lib/Analysis/Presburger/PresburgerSet.cpp --- a/mlir/lib/Analysis/Presburger/PresburgerSet.cpp +++ b/mlir/lib/Analysis/Presburger/PresburgerSet.cpp @@ -213,7 +213,7 @@ // Find out which inequalities of sI correspond to division inequalities for // the local variables of sI. - std::vector repr(sI.getNumLocalIds()); + SmallVector repr(sI.getNumLocalIds()); sI.getLocalReprs(repr); // Add sI's locals to b, after b's locals. Also add b's locals to sI, before diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp --- a/mlir/lib/Analysis/Presburger/Utils.cpp +++ b/mlir/lib/Analysis/Presburger/Utils.cpp @@ -160,14 +160,14 @@ // Extract divisor, the divisor can be negative and hence its sign information // is stored in `signDiv` to reverse the sign of dividend's coefficients. - // Equality must involve the pos-th variable and hence `temp_div` != 0. - int64_t temp_div = cst.atEq(eqInd, pos); - if (temp_div == 0) + // Equality must involve the pos-th variable and hence `tempDiv` != 0. + int64_t tempDiv = cst.atEq(eqInd, pos); + if (tempDiv == 0) return failure(); - int64_t signDiv = temp_div < 0 ? -1 : 1; + int64_t signDiv = tempDiv < 0 ? -1 : 1; // The divisor is always a positive integer. - divisor = temp_div * signDiv; + divisor = tempDiv * signDiv; expr.resize(cst.getNumCols(), 0); for (unsigned i = 0, e = cst.getNumIds(); i < e; ++i) @@ -254,7 +254,7 @@ } void presburger_utils::removeDuplicateDivs( - std::vector> &divs, + SmallVectorImpl> &divs, SmallVectorImpl &denoms, unsigned localOffset, llvm::function_ref merge) { diff --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp --- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp +++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp @@ -624,7 +624,7 @@ const std::vector> &expectedDividends, const SmallVectorImpl &expectedDenominators) { - std::vector> dividends; + SmallVector> dividends; SmallVector denominators; poly.getLocalReprs(dividends, denominators);