[Mlir-commits] [mlir] [mlir][memref] Fix an invalid dim loop motion crash (PR #74204)

Mehdi Amini llvmlistbot at llvm.org
Sun Dec 3 21:49:32 PST 2023


================
@@ -893,8 +893,9 @@ Speculation::Speculatability DimOp::getSpeculatability() {
   if (!rankedSourceType)
     return Speculation::NotSpeculatable;
 
-  // The verifier rejects operations that violate this assertion.
-  assert(constantIndex < rankedSourceType.getRank());
+  if (rankedSourceType.getRank() < constantIndex)
----------------
joker-eph wrote:

There is a subtlety though, you wrote: `tensor.dim 5 %v : tensor<?x?xf32>`
Which is different than:
```
%dim = constant 5
tensor.dim %dim %v : tensor<?x?xf32>
```

We are in the second situation here, where we have SSA operands. 
So there is no verifier that can protect against this situation, and so this your case 1 above I believe.


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


More information about the Mlir-commits mailing list