diff --git a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h --- a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h +++ b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h @@ -54,12 +54,6 @@ /// constructing the necessary DimOp operators. SmallVector getDynOperands(Location loc, Value val, OpBuilder &b); -/// If `size` comes from an AffineMinOp and one of the values of AffineMinOp -/// is a constant then return a new value set to the smallest such constant. -/// If `size` comes from a ConstantOp, return the constant. -/// Otherwise return nullptr. -IntegerAttr getSmallestBoundingIndex(Value size); - /// Computes an upper bound for the result `value` of an index computation. /// Translates AffineMinOps and AffineApplyOps along the use-def chains of the /// index computation to affine constraints and projects out intermediate diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp --- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp @@ -177,41 +177,6 @@ return dynOperands; } -/// If `size` comes from an AffineMinOp and one of the values of AffineMinOp -/// is a constant then return a new value set to the smallest such constant. -/// Otherwise returngetSmallestBoundingIndex nullptr. -IntegerAttr getSmallestBoundingIndex(Value size) { - Optional boundingConst = {}; - if (auto affineMinOp = size.getDefiningOp()) { - for (auto e : affineMinOp.getAffineMap().getResults()) - if (auto cst = e.dyn_cast()) - boundingConst = boundingConst - ? std::min(boundingConst.getValue(), cst.getValue()) - : cst.getValue(); - } else if (auto constIndexOp = size.getDefiningOp()) { - if (constIndexOp.getType().isa()) - boundingConst = constIndexOp.getValue().cast().getInt(); - } else if (auto affineApplyOp = size.getDefiningOp()) { - if (auto cExpr = affineApplyOp.getAffineMap() - .getResult(0) - .dyn_cast()) - boundingConst = cExpr.getValue(); - } else if (auto dimOp = size.getDefiningOp()) { - auto shape = dimOp.source().getType().dyn_cast(); - if (auto constOp = dimOp.index().getDefiningOp()) { - if (auto indexAttr = constOp.getValue().dyn_cast()) { - auto dimIndex = indexAttr.getInt(); - if (!shape.isDynamicDim(dimIndex)) { - boundingConst = shape.getShape()[dimIndex]; - } - } - } - } - if (boundingConst && *boundingConst >= 0) - return Builder(size.getContext()).getIndexAttr(*boundingConst); - return nullptr; -} - void getUpperBoundForIndex(Value value, AffineMap &boundMap, SmallVectorImpl &boundOperands) { // Initialize `boundMap` and `boundOperands` to the identity returning