mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
Revert "[MLIR][Presburger] Use SmallVector
instead of std::vector
in getLocalRepr
"
This reverts commit 3cc5447728
.
SmallVector inside SmallVector are not optimized.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D119005
This commit is contained in:
parent
d36bd08572
commit
37bad565bf
@ -285,14 +285,12 @@ public:
|
||||
/// 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(SmallVectorImpl<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVectorImpl<unsigned> &denominators,
|
||||
SmallVectorImpl<presburger_utils::MaybeLocalRepr> &repr) const;
|
||||
void
|
||||
getLocalReprs(SmallVectorImpl<presburger_utils::MaybeLocalRepr> &repr) const;
|
||||
void getLocalReprs(SmallVectorImpl<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVectorImpl<unsigned> &denominators) const;
|
||||
void getLocalReprs(std::vector<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVector<unsigned, 4> &denominators,
|
||||
std::vector<presburger_utils::MaybeLocalRepr> &repr) const;
|
||||
void getLocalReprs(std::vector<presburger_utils::MaybeLocalRepr> &repr) const;
|
||||
void getLocalReprs(std::vector<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVector<unsigned, 4> &denominators) const;
|
||||
|
||||
/// The type of bound: equal, lower bound or upper bound.
|
||||
enum BoundType { EQ, LB, UB };
|
||||
|
@ -65,7 +65,7 @@ MaybeLocalRepr computeSingleVarRepr(const IntegerPolyhedron &cst,
|
||||
/// the divisions are not merged. `merge` can also do side effects, For example
|
||||
/// it can merge the local identifiers in IntegerPolyhedron.
|
||||
void removeDuplicateDivs(
|
||||
SmallVectorImpl<SmallVector<int64_t, 8>> &divs,
|
||||
std::vector<SmallVector<int64_t, 8>> &divs,
|
||||
SmallVectorImpl<unsigned> &denoms, unsigned localOffset,
|
||||
llvm::function_ref<bool(unsigned i, unsigned j)> merge);
|
||||
|
||||
|
@ -829,24 +829,23 @@ bool IntegerPolyhedron::containsPoint(ArrayRef<int64_t> point) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void IntegerPolyhedron::getLocalReprs(
|
||||
SmallVectorImpl<MaybeLocalRepr> &repr) const {
|
||||
SmallVector<SmallVector<int64_t, 8>> dividends(getNumLocalIds());
|
||||
void IntegerPolyhedron::getLocalReprs(std::vector<MaybeLocalRepr> &repr) const {
|
||||
std::vector<SmallVector<int64_t, 8>> dividends(getNumLocalIds());
|
||||
SmallVector<unsigned, 4> denominators(getNumLocalIds());
|
||||
getLocalReprs(dividends, denominators, repr);
|
||||
}
|
||||
|
||||
void IntegerPolyhedron::getLocalReprs(
|
||||
SmallVectorImpl<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVectorImpl<unsigned> &denominators) const {
|
||||
SmallVector<MaybeLocalRepr> repr(getNumLocalIds());
|
||||
std::vector<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVector<unsigned, 4> &denominators) const {
|
||||
std::vector<MaybeLocalRepr> repr(getNumLocalIds());
|
||||
getLocalReprs(dividends, denominators, repr);
|
||||
}
|
||||
|
||||
void IntegerPolyhedron::getLocalReprs(
|
||||
SmallVectorImpl<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVectorImpl<unsigned> &denominators,
|
||||
SmallVectorImpl<MaybeLocalRepr> &repr) const {
|
||||
std::vector<SmallVector<int64_t, 8>> ÷nds,
|
||||
SmallVector<unsigned, 4> &denominators,
|
||||
std::vector<MaybeLocalRepr> &repr) const {
|
||||
|
||||
repr.resize(getNumLocalIds());
|
||||
dividends.resize(getNumLocalIds());
|
||||
@ -1104,7 +1103,7 @@ void IntegerPolyhedron::mergeLocalIds(IntegerPolyhedron &other) {
|
||||
polyB.insertLocalId(0, initLocals);
|
||||
|
||||
// Get division representations from each poly.
|
||||
SmallVector<SmallVector<int64_t, 8>> divsA, divsB;
|
||||
std::vector<SmallVector<int64_t, 8>> divsA, divsB;
|
||||
SmallVector<unsigned, 4> denomsA, denomsB;
|
||||
polyA.getLocalReprs(divsA, denomsA);
|
||||
polyB.getLocalReprs(divsB, denomsB);
|
||||
|
@ -213,7 +213,7 @@ static void subtractRecursively(IntegerPolyhedron &b, Simplex &simplex,
|
||||
|
||||
// Find out which inequalities of sI correspond to division inequalities for
|
||||
// the local variables of sI.
|
||||
SmallVector<MaybeLocalRepr> repr(sI.getNumLocalIds());
|
||||
std::vector<MaybeLocalRepr> repr(sI.getNumLocalIds());
|
||||
sI.getLocalReprs(repr);
|
||||
|
||||
// Add sI's locals to b, after b's locals. Also add b's locals to sI, before
|
||||
|
@ -160,14 +160,14 @@ static LogicalResult getDivRepr(const IntegerPolyhedron &cst, unsigned pos,
|
||||
|
||||
// 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 `tempDiv` != 0.
|
||||
int64_t tempDiv = cst.atEq(eqInd, pos);
|
||||
if (tempDiv == 0)
|
||||
// Equality must involve the pos-th variable and hence `temp_div` != 0.
|
||||
int64_t temp_div = cst.atEq(eqInd, pos);
|
||||
if (temp_div == 0)
|
||||
return failure();
|
||||
int64_t signDiv = tempDiv < 0 ? -1 : 1;
|
||||
int64_t signDiv = temp_div < 0 ? -1 : 1;
|
||||
|
||||
// The divisor is always a positive integer.
|
||||
divisor = tempDiv * signDiv;
|
||||
divisor = temp_div * signDiv;
|
||||
|
||||
expr.resize(cst.getNumCols(), 0);
|
||||
for (unsigned i = 0, e = cst.getNumIds(); i < e; ++i)
|
||||
@ -254,7 +254,7 @@ MaybeLocalRepr presburger_utils::computeSingleVarRepr(
|
||||
}
|
||||
|
||||
void presburger_utils::removeDuplicateDivs(
|
||||
SmallVectorImpl<SmallVector<int64_t, 8>> &divs,
|
||||
std::vector<SmallVector<int64_t, 8>> &divs,
|
||||
SmallVectorImpl<unsigned> &denoms, unsigned localOffset,
|
||||
llvm::function_ref<bool(unsigned i, unsigned j)> merge) {
|
||||
|
||||
|
@ -624,7 +624,7 @@ static void checkDivisionRepresentation(
|
||||
const std::vector<SmallVector<int64_t, 8>> &expectedDividends,
|
||||
const SmallVectorImpl<unsigned> &expectedDenominators) {
|
||||
|
||||
SmallVector<SmallVector<int64_t, 8>> dividends;
|
||||
std::vector<SmallVector<int64_t, 8>> dividends;
|
||||
SmallVector<unsigned, 4> denominators;
|
||||
|
||||
poly.getLocalReprs(dividends, denominators);
|
||||
|
Loading…
Reference in New Issue
Block a user