[Mlir-commits] [mlir] [MLIR] Fix mlir-opt crash in ReshapeOpsUtils.cpp when collapse_shape index is invalid (PR #173791)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Dec 29 01:25:52 PST 2025


================
@@ -451,7 +451,9 @@ mlir::getSymbolLessAffineMaps(ArrayRef<ReassociationExprs> reassociation) {
   SmallVector<AffineMap, 4> maps;
   maps.reserve(reassociation.size());
   for (const auto &exprs : reassociation) {
-    assert(!exprs.empty());
+    if (exprs.empty()) {
+      return {};
+    }
----------------
ftynse wrote:

Generally, compiler code should assume/assert that the IR has passed the verifier, so this should stay as an assertion unless it is somehow called on unverified code.

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


More information about the Mlir-commits mailing list