diff --git a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h --- a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h +++ b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h @@ -183,7 +183,7 @@ /// An index-typed value or the dimension of a shaped-type value. using ValueDim = std::pair; - ValueBoundsConstraintSet(Value value, std::optional dim); + ValueBoundsConstraintSet(MLIRContext *ctx); /// Iteratively process all elements on the worklist until an index-typed /// value or shaped value meets `stopCondition`. Such values are not processed diff --git a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp --- a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp +++ b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp @@ -39,11 +39,8 @@ return std::nullopt; } -ValueBoundsConstraintSet::ValueBoundsConstraintSet(Value value, - std::optional dim) - : builder(value.getContext()) { - insert(value, dim, /*isSymbol=*/false); -} +ValueBoundsConstraintSet::ValueBoundsConstraintSet(MLIRContext *ctx) + : builder(ctx) {} #ifndef NDEBUG static void assertValidValueDim(Value value, std::optional dim) { @@ -246,7 +243,8 @@ // Process the backward slice of `value` (i.e., reverse use-def chain) until // `stopCondition` is met. ValueDim valueDim = std::make_pair(value, dim.value_or(kIndexValue)); - ValueBoundsConstraintSet cstr(value, dim); + ValueBoundsConstraintSet cstr(value.getContext()); + int64_t pos = cstr.insert(value, dim, /*isSymbol=*/false); cstr.processWorklist(stopCondition); // Project out all variables (apart from `valueDim`) that do not match the @@ -261,7 +259,6 @@ }); // Compute lower and upper bounds for `valueDim`. - int64_t pos = cstr.getPos(value, dim); SmallVector lb(1), ub(1); cstr.cstr.getSliceBounds(pos, 1, value.getContext(), &lb, &ub, /*getClosedUB=*/true); @@ -411,8 +408,8 @@ // Process the backward slice of `value` (i.e., reverse use-def chain) until // `stopCondition` is met. - ValueBoundsConstraintSet cstr(value, dim); - int64_t pos = cstr.getPos(value, dim); + ValueBoundsConstraintSet cstr(value.getContext()); + int64_t pos = cstr.insert(value, dim, /*isSymbol=*/false); if (stopCondition) { cstr.processWorklist(stopCondition); } else {