[Mlir-commits] [mlir] [NFC][mlir][bufferization] Simplify TensorType::getBufferType() (PR #199034)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu May 21 07:05:02 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Andrei Golubev (andrey-golubev)

<details>
<summary>Changes</summary>

The implementation for a builtin TensorType's TensorLikeType interface is a bit overly complex for no reason: it calls `getMemRefType()` whereas in reality `options.unknownTypeConverterFn()` would directly be called due to the way the current code is written. Remove what is effectively a wrapper function so that the current semantics is a bit clearer.

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


1 Files Affected:

- (modified) mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp (+1-1) 


``````````diff
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
index bd177ba1afccd..b36aac8c68d36 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
@@ -48,7 +48,7 @@ struct BuiltinTensorExternalModel
       return emitError() << "could not infer memory space";
 
     return cast<BufferLikeType>(
-        getMemRefType(tensorType, options, /*layout=*/{}, *memSpace));
+        options.unknownTypeConverterFn(tensorType, *memSpace, options));
   }
 
   mlir::LogicalResult verifyCompatibleBufferType(

``````````

</details>


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


More information about the Mlir-commits mailing list