[Mlir-commits] [mlir] 2e52b09 - [mlir] Remove dead code in Analysis/FlatLinearValueConstraints.

Alexander Belyaev llvmlistbot at llvm.org
Tue Jul 18 23:28:08 PDT 2023


Author: Alexander Belyaev
Date: 2023-07-19T08:19:53+02:00
New Revision: 2e52b093cf31c446601bc2c718e6500046f25baf

URL: https://github.com/llvm/llvm-project/commit/2e52b093cf31c446601bc2c718e6500046f25baf
DIFF: https://github.com/llvm/llvm-project/commit/2e52b093cf31c446601bc2c718e6500046f25baf.diff

LOG: [mlir] Remove dead code in Analysis/FlatLinearValueConstraints.

Differential Revision: https://reviews.llvm.org/D154830

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
    mlir/lib/Analysis/FlatLinearValueConstraints.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
index d27c74b79693fe..f3c46f5efd73cb 100644
--- a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
+++ b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
@@ -66,14 +66,6 @@ class FlatLinearConstraints : public presburger::IntegerPolyhedron {
   /// Return the kind of this object.
   Kind getKind() const override { return Kind::FlatLinearConstraints; }
 
-  static bool classof(const IntegerRelation *cst) {
-    return cst->getKind() >= Kind::FlatLinearConstraints &&
-           cst->getKind() <= Kind::FlatAffineRelation;
-  }
-
-  /// Clones this object.
-  std::unique_ptr<FlatLinearConstraints> clone() const;
-
   /// Adds a bound for the variable at the specified position with constraints
   /// being drawn from the specified bound map. In case of an EQ bound, the
   /// bound map is expected to have exactly one result. In case of a LB/UB, the
@@ -290,20 +282,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
   /// Creates an affine constraint system from an IntegerSet.
   explicit FlatLinearValueConstraints(IntegerSet set, ValueRange operands = {});
 
-  // Construct a hyperrectangular constraint set from ValueRanges that represent
-  // induction variables, lower and upper bounds. `ivs`, `lbs` and `ubs` are
-  // expected to match one to one. The order of variables and constraints is:
-  //
-  // ivs | lbs | ubs | eq/ineq
-  // ----+-----+-----+---------
-  //   1   -1     0      >= 0
-  // ----+-----+-----+---------
-  //  -1    0     1      >= 0
-  //
-  // All dimensions as set as VarKind::SetDim.
-  static FlatLinearValueConstraints
-  getHyperrectangular(ValueRange ivs, ValueRange lbs, ValueRange ubs);
-
   /// Return the kind of this object.
   Kind getKind() const override { return Kind::FlatLinearValueConstraints; }
 
@@ -338,9 +316,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
     for (unsigned i = start; i < end; i++)
       values->push_back(getValue(i));
   }
-  inline void getAllValues(SmallVectorImpl<Value> *values) const {
-    getValues(0, getNumDimAndSymbolVars(), values);
-  }
 
   inline ArrayRef<std::optional<Value>> getMaybeValues() const {
     return {values.data(), values.size()};
@@ -359,9 +334,6 @@ class FlatLinearValueConstraints : public FlatLinearConstraints {
     return values[pos].has_value();
   }
 
-  /// Returns true if at least one variable has an associated Value.
-  bool hasValues() const;
-
   unsigned appendDimVar(ValueRange vals);
   using FlatLinearConstraints::appendDimVar;
 

diff  --git a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
index 2dbb2e6cc0dcbb..3f000182250069 100644
--- a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
+++ b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
@@ -148,10 +148,6 @@ LogicalResult mlir::getFlattenedAffineExprs(
 // FlatLinearConstraints
 //===----------------------------------------------------------------------===//
 
-std::unique_ptr<FlatLinearConstraints> FlatLinearConstraints::clone() const {
-  return std::make_unique<FlatLinearConstraints>(*this);
-}
-
 // Similar to `composeMap` except that no Values need be associated with the
 // constraint system nor are they looked at -- the dimensions and symbols of
 // `other` are expected to correspond 1:1 to `this` system.
@@ -849,48 +845,6 @@ FlatLinearValueConstraints::FlatLinearValueConstraints(IntegerSet set,
   append(localVarCst);
 }
 
-// Construct a hyperrectangular constraint set from ValueRanges that represent
-// induction variables, lower and upper bounds. `ivs`, `lbs` and `ubs` are
-// expected to match one to one. The order of variables and constraints is:
-//
-// ivs | lbs | ubs | eq/ineq
-// ----+-----+-----+---------
-//   1   -1     0      >= 0
-// ----+-----+-----+---------
-//  -1    0     1      >= 0
-//
-// All dimensions as set as VarKind::SetDim.
-FlatLinearValueConstraints
-FlatLinearValueConstraints::getHyperrectangular(ValueRange ivs, ValueRange lbs,
-                                                ValueRange ubs) {
-  FlatLinearValueConstraints res;
-  unsigned nIvs = ivs.size();
-  assert(nIvs == lbs.size() && "expected as many lower bounds as ivs");
-  assert(nIvs == ubs.size() && "expected as many upper bounds as ivs");
-
-  if (nIvs == 0)
-    return res;
-
-  res.appendDimVar(ivs);
-  unsigned lbsStart = res.appendDimVar(lbs);
-  unsigned ubsStart = res.appendDimVar(ubs);
-
-  MLIRContext *ctx = ivs.front().getContext();
-  for (int ivIdx = 0, e = nIvs; ivIdx < e; ++ivIdx) {
-    // iv - lb >= 0
-    AffineMap lb = AffineMap::get(/*dimCount=*/3 * nIvs, /*symbolCount=*/0,
-                                  getAffineDimExpr(lbsStart + ivIdx, ctx));
-    if (failed(res.addBound(BoundType::LB, ivIdx, lb)))
-      llvm_unreachable("Unexpected FlatLinearValueConstraints creation error");
-    // -iv + ub >= 0
-    AffineMap ub = AffineMap::get(/*dimCount=*/3 * nIvs, /*symbolCount=*/0,
-                                  getAffineDimExpr(ubsStart + ivIdx, ctx));
-    if (failed(res.addBound(BoundType::UB, ivIdx, ub)))
-      llvm_unreachable("Unexpected FlatLinearValueConstraints creation error");
-  }
-  return res;
-}
-
 unsigned FlatLinearValueConstraints::appendDimVar(ValueRange vals) {
   unsigned pos = getNumDimVars();
   return insertVar(VarKind::SetDim, pos, vals);
@@ -940,11 +894,6 @@ unsigned FlatLinearValueConstraints::insertVar(VarKind kind, unsigned pos,
   return absolutePos;
 }
 
-bool FlatLinearValueConstraints::hasValues() const {
-  return llvm::any_of(
-      values, [](const std::optional<Value> &var) { return var.has_value(); });
-}
-
 /// Checks if two constraint systems are in the same space, i.e., if they are
 /// associated with the same set of variables, appearing in the same order.
 static bool areVarsAligned(const FlatLinearValueConstraints &a,


        


More information about the Mlir-commits mailing list