Skip to content

Commit 2e52b09

Browse files
committed
[mlir] Remove dead code in Analysis/FlatLinearValueConstraints.
Differential Revision: https://reviews.llvm.org/D154830
1 parent 95bdd6e commit 2e52b09

File tree

2 files changed

+0
-79
lines changed

2 files changed

+0
-79
lines changed

mlir/include/mlir/Analysis/FlatLinearValueConstraints.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ class FlatLinearConstraints : public presburger::IntegerPolyhedron {
6666
/// Return the kind of this object.
6767
Kind getKind() const override { return Kind::FlatLinearConstraints; }
6868

69-
static bool classof(const IntegerRelation *cst) {
70-
return cst->getKind() >= Kind::FlatLinearConstraints &&
71-
cst->getKind() <= Kind::FlatAffineRelation;
72-
}
73-
74-
/// Clones this object.
75-
std::unique_ptr<FlatLinearConstraints> clone() const;
76-
7769
/// Adds a bound for the variable at the specified position with constraints
7870
/// being drawn from the specified bound map. In case of an EQ bound, the
7971
/// bound map is expected to have exactly one result. In case of a LB/UB, the
@@ -290,20 +282,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
290282
/// Creates an affine constraint system from an IntegerSet.
291283
explicit FlatLinearValueConstraints(IntegerSet set, ValueRange operands = {});
292284

293-
// Construct a hyperrectangular constraint set from ValueRanges that represent
294-
// induction variables, lower and upper bounds. `ivs`, `lbs` and `ubs` are
295-
// expected to match one to one. The order of variables and constraints is:
296-
//
297-
// ivs | lbs | ubs | eq/ineq
298-
// ----+-----+-----+---------
299-
// 1 -1 0 >= 0
300-
// ----+-----+-----+---------
301-
// -1 0 1 >= 0
302-
//
303-
// All dimensions as set as VarKind::SetDim.
304-
static FlatLinearValueConstraints
305-
getHyperrectangular(ValueRange ivs, ValueRange lbs, ValueRange ubs);
306-
307285
/// Return the kind of this object.
308286
Kind getKind() const override { return Kind::FlatLinearValueConstraints; }
309287

@@ -338,9 +316,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
338316
for (unsigned i = start; i < end; i++)
339317
values->push_back(getValue(i));
340318
}
341-
inline void getAllValues(SmallVectorImpl<Value> *values) const {
342-
getValues(0, getNumDimAndSymbolVars(), values);
343-
}
344319

345320
inline ArrayRef<std::optional<Value>> getMaybeValues() const {
346321
return {values.data(), values.size()};
@@ -359,9 +334,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
359334
return values[pos].has_value();
360335
}
361336

362-
/// Returns true if at least one variable has an associated Value.
363-
bool hasValues() const;
364-
365337
unsigned appendDimVar(ValueRange vals);
366338
using FlatLinearConstraints::appendDimVar;
367339

mlir/lib/Analysis/FlatLinearValueConstraints.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ LogicalResult mlir::getFlattenedAffineExprs(
148148
// FlatLinearConstraints
149149
//===----------------------------------------------------------------------===//
150150

151-
std::unique_ptr<FlatLinearConstraints> FlatLinearConstraints::clone() const {
152-
return std::make_unique<FlatLinearConstraints>(*this);
153-
}
154-
155151
// Similar to `composeMap` except that no Values need be associated with the
156152
// constraint system nor are they looked at -- the dimensions and symbols of
157153
// `other` are expected to correspond 1:1 to `this` system.
@@ -849,48 +845,6 @@ FlatLinearValueConstraints::FlatLinearValueConstraints(IntegerSet set,
849845
append(localVarCst);
850846
}
851847

852-
// Construct a hyperrectangular constraint set from ValueRanges that represent
853-
// induction variables, lower and upper bounds. `ivs`, `lbs` and `ubs` are
854-
// expected to match one to one. The order of variables and constraints is:
855-
//
856-
// ivs | lbs | ubs | eq/ineq
857-
// ----+-----+-----+---------
858-
// 1 -1 0 >= 0
859-
// ----+-----+-----+---------
860-
// -1 0 1 >= 0
861-
//
862-
// All dimensions as set as VarKind::SetDim.
863-
FlatLinearValueConstraints
864-
FlatLinearValueConstraints::getHyperrectangular(ValueRange ivs, ValueRange lbs,
865-
ValueRange ubs) {
866-
FlatLinearValueConstraints res;
867-
unsigned nIvs = ivs.size();
868-
assert(nIvs == lbs.size() && "expected as many lower bounds as ivs");
869-
assert(nIvs == ubs.size() && "expected as many upper bounds as ivs");
870-
871-
if (nIvs == 0)
872-
return res;
873-
874-
res.appendDimVar(ivs);
875-
unsigned lbsStart = res.appendDimVar(lbs);
876-
unsigned ubsStart = res.appendDimVar(ubs);
877-
878-
MLIRContext *ctx = ivs.front().getContext();
879-
for (int ivIdx = 0, e = nIvs; ivIdx < e; ++ivIdx) {
880-
// iv - lb >= 0
881-
AffineMap lb = AffineMap::get(/*dimCount=*/3 * nIvs, /*symbolCount=*/0,
882-
getAffineDimExpr(lbsStart + ivIdx, ctx));
883-
if (failed(res.addBound(BoundType::LB, ivIdx, lb)))
884-
llvm_unreachable("Unexpected FlatLinearValueConstraints creation error");
885-
// -iv + ub >= 0
886-
AffineMap ub = AffineMap::get(/*dimCount=*/3 * nIvs, /*symbolCount=*/0,
887-
getAffineDimExpr(ubsStart + ivIdx, ctx));
888-
if (failed(res.addBound(BoundType::UB, ivIdx, ub)))
889-
llvm_unreachable("Unexpected FlatLinearValueConstraints creation error");
890-
}
891-
return res;
892-
}
893-
894848
unsigned FlatLinearValueConstraints::appendDimVar(ValueRange vals) {
895849
unsigned pos = getNumDimVars();
896850
return insertVar(VarKind::SetDim, pos, vals);
@@ -940,11 +894,6 @@ unsigned FlatLinearValueConstraints::insertVar(VarKind kind, unsigned pos,
940894
return absolutePos;
941895
}
942896

943-
bool FlatLinearValueConstraints::hasValues() const {
944-
return llvm::any_of(
945-
values, [](const std::optional<Value> &var) { return var.has_value(); });
946-
}
947-
948897
/// Checks if two constraint systems are in the same space, i.e., if they are
949898
/// associated with the same set of variables, appearing in the same order.
950899
static bool areVarsAligned(const FlatLinearValueConstraints &a,

0 commit comments

Comments
 (0)