[Mlir-commits] [mlir] [mlir][bufferization] Return BufferLikeType in BufferizableOpInterface (PR #144867)

Andrei Golubev llvmlistbot at llvm.org
Mon Jun 30 03:37:36 PDT 2025


================
@@ -196,17 +196,17 @@ struct SelectOpInterface
     if (failed(trueType) || failed(falseType))
       return failure();
     if (*trueType == *falseType)
-      return *trueType;
+      return cast<BufferLikeType>(*trueType);
     if (trueType->getMemorySpace() != falseType->getMemorySpace())
----------------
andrey-golubev wrote:

I don't plan on extending `arith.select` (as of now at least) but it seems that it's going to be much less churn due to "cast to memref" / "cast to buffer-like" across multiple places if there's a memory space tied to buffer-like (which also could be optional and thus return `nullptr`).

here, for instance, as I get `falseType` and `trueType` already as buffer-like by the API, I wouldn't need to cast them first to  memrefs (to check memory space compatibility) and then cast "back" to buffer-like.

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


More information about the Mlir-commits mailing list