diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp --- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp +++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp @@ -349,7 +349,8 @@ return true; SmallPtrSet uniqueIds; - ArrayRef> maybeValues = cst.getMaybeValues(); + ArrayRef> maybeValues = + cst.getMaybeValues().slice(start, end - start); for (Optional val : maybeValues) { if (val.hasValue() && !uniqueIds.insert(val.getValue()).second) return false;