[Mlir-commits] [mlir] [MLIR][IndexingMapOpInterface]: Validate maps and operands before composing loop ranges (PR #173434)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jan 2 12:21:15 PST 2026


================
@@ -23,44 +23,44 @@ LogicalResult mlir::IndexingMapOpInterface::verifyImpl() {
            << ") to be equal to the number of input/output operands ("
            << getOperation()->getNumOperands() << ")";
 
-  AffineMap invertedMap = getShapesToLoopsMap();
-  if (!invertedMap) {
-    std::string str;
-    llvm::raw_string_ostream os(str);
-    getLoopsToShapesMap().print(os);
-    return this->emitOpError("invalid indexing maps are non-invertible: ")
-           << "(" << str << ")";
-  }
-
-  SmallVector<int64_t> endLoopRangeValues = getStaticLoopRanges();
+  SmallVector<int64_t> allShapesSizes;
----------------
MaheshRavishankar wrote:

Sorry the github WebUI messes up the diff. Got a cleaner diff when I was reviewing using VSCode. IIUC you are just making sure that the rank of the operand is consistent with the number of results of the indexing map first before you getStaticLoopRanges. I think if you just check that the change to check the `invertedMap.getNumResults() != endLoopRangeValues.size()` below should not be needed, since it will be true by construction?

https://github.com/llvm/llvm-project/pull/173434


More information about the Mlir-commits mailing list