[Mlir-commits] [mlir] [NFC][mlir][bufferization] Remove getMemRefType() helper (PR #199034)

Andrei Golubev llvmlistbot at llvm.org
Wed Jun 3 02:19:46 PDT 2026


================
@@ -1006,7 +983,7 @@ FailureOr<BufferLikeType> bufferization::detail::defaultGetBufferType(
     return op->emitError("could not infer memory space");
 
   return cast<BufferLikeType>(
-      getMemRefType(tensorType, options, /*layout=*/{}, *memSpace));
+      options.unknownTypeConverterFn(tensorType, *memSpace, options));
----------------
andrey-golubev wrote:

what do you mean by "update"?

regarding,

> It should return an unranked memref if the tensor is unranked.

I believe this is already the case (see the first if-statement in `getMemRefTypeWithFullyDynamicLayout`):
https://github.com/llvm/llvm-project/blob/39658a8fa9d1900f90f218a5eeeb205c227e1262/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp#L838-L858

I imagine the way it worked before was:
* getMemRefType() would return-early for unranked case
* unknown type converter had the same code path for unranked case

As I removed the getMemRefType() part, we still have the coverage for unranked within default unknown type conversion, as well as within the lambda defined in Bufferize.cpp (second case) -- `getMemRefTypeWithStaticIdentityLayout()` also handles unranked case.

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


More information about the Mlir-commits mailing list